Page 1 of 1
WildEdit Newbie Find expression
Posted: Wed May 25, 2005 3:06 pm
by PaulChad
Hi all,
I'm new to WildEdit and need a bit of help.
I need an expression that will remove all the blank lines in a file and also for each blank line remove the next two lines which may or may not contain text.
Thanks,
Paul.
Posted: Wed May 25, 2005 4:03 pm
by Bob Hansen
Search for ^\n.*\n.*\n
Replace with nothing
POSIX with Regular Expression checked
Posted: Wed May 25, 2005 4:07 pm
by MudGuard
Careful!
Whether this works as assumed depends on the setting for
'.' does not match a newline character
If that option is switched off, it will match not only two lines, but ALL lines after the blank line
Posted: Wed May 25, 2005 4:29 pm
by Bob Hansen
Thanks for that caution MudGuard.
I was responding with TextPad, forgot it was the WildEdit forum. Only tested in TextPad, not in my copy of WildEdit.
Many more options to define, tough to assume default values in WildEdit.
Posted: Thu May 26, 2005 10:40 am
by PaulChad
Thanks for the help, it gave me enough to go on, in the end I used:
^\r\n.*\r\n.*\r\n
Help Again!
Posted: Thu May 26, 2005 12:20 pm
by PaulChad
The first expression has worked a treat, but I also need to remove the first line from each file is this possible?
Thanks,
Paul.
Posted: Thu May 26, 2005 1:09 pm
by ben_josephs
Hmm.
\A or
\` should match the beginning of the document. These are not in the WildEdit documentation, but you'll find them in the documentation for the regex library it uses at
http://www.boost.org/libs/regex/doc/syntax.html.
However, they seem to match the beginning of
any line. I think this is a bug (but I don't know what in).
If they behaved as expected, then
\A.*\r\n (with option
'.' does not match a newline character ticked) should match only the first line. As it is, it matches
any line.
Helios...?