Problem with linebreaks (Bug?)
Posted: Thu May 06, 2010 5:10 pm
Basically, I'm trying to use TextPad to cleanup some HTML files by doing turning this:
<td width=190 valign=top style='width:142.6pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
padding:0cm 5.25pt 0cm 5.25pt'>
into this:
<td>
I've used this expression:
Find: <\([^[:space:]]+\)[[:space:]][^>]+>
Replace with: <\1>
It works okay if the tag is in a single line, like this:
<div class=Section1>
But not if it's in multiple lines:
<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0
style='margin-left:5.25pt;border-collapse:collapse;border:none'>
I've tried to use this expression instead:
<\([^[:space:]]+\)[[:space:]]\([^>]\|\n\)+>
But the editor says that "either ( or { doesn't match"
I've tried this:
<\([^[:space:]]+\)[[:space:]]\([^>]\|[[:space:]]\)+>
But unlike what the help says, [:space:] isn't matching line breaks.
This works if there's a single line break, but not if there's more than two lines:
<\([^[:space:]]+\)[[:space:]][^>]+\n[^>]+>
Am I doing something wrong, or is it a bug on the regular expressions?
Is there a way around this?
<td width=190 valign=top style='width:142.6pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
padding:0cm 5.25pt 0cm 5.25pt'>
into this:
<td>
I've used this expression:
Find: <\([^[:space:]]+\)[[:space:]][^>]+>
Replace with: <\1>
It works okay if the tag is in a single line, like this:
<div class=Section1>
But not if it's in multiple lines:
<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0
style='margin-left:5.25pt;border-collapse:collapse;border:none'>
I've tried to use this expression instead:
<\([^[:space:]]+\)[[:space:]]\([^>]\|\n\)+>
But the editor says that "either ( or { doesn't match"
I've tried this:
<\([^[:space:]]+\)[[:space:]]\([^>]\|[[:space:]]\)+>
But unlike what the help says, [:space:] isn't matching line breaks.
This works if there's a single line break, but not if there's more than two lines:
<\([^[:space:]]+\)[[:space:]][^>]+\n[^>]+>
Am I doing something wrong, or is it a bug on the regular expressions?
Is there a way around this?