WildEdit Newbie Find expression

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
PaulChad
Posts: 3
Joined: Wed May 25, 2005 2:13 pm

WildEdit Newbie Find expression

Post 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.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Search for ^\n.*\n.*\n

Replace with nothing

POSIX with Regular Expression checked
Hope this was helpful.............good luck,
Bob
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post 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
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post 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.
Hope this was helpful.............good luck,
Bob
PaulChad
Posts: 3
Joined: Wed May 25, 2005 2:13 pm

Post by PaulChad »

Thanks for the help, it gave me enough to go on, in the end I used:
^\r\n.*\r\n.*\r\n
PaulChad
Posts: 3
Joined: Wed May 25, 2005 2:13 pm

Help Again!

Post 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.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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...?
Post Reply