Page 1 of 1

deleting multiple lines at a time in the "Find what&quo

Posted: Wed Jul 28, 2004 9:56 pm
by ethib2000
Hi,

In a text file I have multiple lines that I want to delete. I am using the begening of a line command to get rid of these lines. But It looks like I have to paste one command at a time to make it work. I would like to paste all of these regex to delete the lines that I want.

^Unique Visitor.*?$
^Visitors Who Visited Once.*?$
^Visitors Who Visited More.*?$
^Average Visits per Visitor.*?$

Instead of

^Unique Visitor.*?$

make it run than delete than the next one

^Visitors Who Visited Once.*?$

etc.. ect..


Is there something missing in my expression?


Thanks

Posted: Wed Jul 28, 2004 10:13 pm
by s_reynisson
From WE's help file:
Alternatives Alternatives occur when the expression can match either one sub-expression or another, each alternative is separated by a "|", or by a newline character if that option is set. Each alternative is the largest possible previous sub-expression; this is the opposite behavior from repetition operators.
Examples:
"a(b|c)" could match "ab" or "ac".
"abc|def" could match "abc" or "def".
So you're looking at something like
^(Unique Visitor)|(Visitors Who Visited Once)|(more options...).*?$
HTH

Posted: Wed Jul 28, 2004 10:36 pm
by ben_josephs
s_reynisson wrote:
Alternatives ... Each alternative is the largest possible previous sub-expression...
So you're looking at something like
^(Unique Visitor)|(Visitors Who Visited Once)|(more options...).*?$
You need to adjust the parentheses so that the first alternative doesn't include the "^" and the last one doesn't include the ".*?$":

Code: Select all

^(Unique Visitor|Visitors Who Visited Once|more options...).*?$

Posted: Wed Jul 28, 2004 10:44 pm
by s_reynisson
To something like this perhaps?

Code: Select all

^((Unique Visitor)|(Visitors Who Visited Once)|(more options...)).*?$
ben_josephs wrote:You need to adjust the parentheses so that the first alternative doesn't include the "^" and the last one doesn't include the ".*?$":

Code: Select all

^(Unique Visitor|Visitors Who Visited Once|more options...).*?$

Posted: Thu Jul 29, 2004 8:06 am
by ben_josephs
s_reynisson wrote:

Code: Select all

^((Unique Visitor)|(Visitors Who Visited Once)|(more options...)).*?$
The inner parentheses serve no purpose unless you need to capture the particular alternative subexpression that matched, for use in the replacement, either in a matched subexpression expression ($N) or in a conditional expression expression ($NE:E).