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?
Problem with linebreaks (Bug?)
Moderators: AmigoJack, bbadmin, helios, MudGuard
Hello,
Bad news, TextPad S&R does not work across multiple lines.
You want to get the sister program WildEdit for that.
Bad news, TextPad S&R does not work across multiple lines.
You want to get the sister program WildEdit for that.
Thank you, and
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
Best Wishes,
Obo
http://buddhadust.net/
check out the What's New? Oblog:
http://buddhadust.net/dhammatalk/dhamma ... ts.new.htm
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
It's not quite that bad, although it's not good enough to help the OP.
What TextPad's regex engine doesn't allow is a repeated \n or a \n in a grouped expression. So there's no way to match an arbitrary number of newlines.
This is a bug in the sense that, while most modern regex tools can handle this sort of thing, TextPad's regex engine can't.
BTW, a good tip to maintain your sanity is to use Posix regex syntax, which will (usually) reduce the number of backslashes in your regexes and make them more like those recognised by most other modern tools.
What TextPad's regex engine doesn't allow is a repeated \n or a \n in a grouped expression. So there's no way to match an arbitrary number of newlines.
This is a bug in the sense that, while most modern regex tools can handle this sort of thing, TextPad's regex engine can't.
BTW, a good tip to maintain your sanity is to use Posix regex syntax, which will (usually) reduce the number of backslashes in your regexes and make them more like those recognised by most other modern tools.
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax