Andy,<br/>
<br/>
Thanks for the input. The original problem came from a co-worker of
mine who is limited by the third-party program that only allows the
simple regular expression in a text box, so the loop (which was my first
though, too) won't work.<br/>
<br/>
If I come up with anything that works I'll be sure to tell everyone.<br/>
<br/>
Dan<br/>
<br/>
On Sun, May 14, 2006 01:14, Andy Lester wrote:<br/>
> On Sun, May 14, 2006 at 12:37:29AM -0500, Daniel Linder
(dan@linder.org)<br/>
> wrote:<br/>
>> For example, this line:<br/>
>><br/>
>> ^var1=(?i)(.*)(5705)(.*)<br/>
>><br/>
>> will find all lines that begin with "var1=", followed
byt any<br/>
>> characters, then 5705, then any other characters. This filter
works<br/>
>> fine.<br/>
> <br/>
> Actually, that breaks down to<br/>
> <br/>
> ^var1= beginning of the line, and then "var1="<br/>
> (?i) an optional "i"<br/>
> (.*) any string<br/>
> (5705) the string "5705"<br/>
> (.*) any other string<br/>
> <br/>
> The (.*) at the end is useless because it will always match in this<br/>
> case, and at the end of the line, you don't care.<br/>
> <br/>
> <br/>
>> What I want to do is write a filter that finds the opposite
lines; i.e<br/>
>> all<br/>
>> lines that begin with "var1=" but do not have 5705 in
their<br/>
>> value. I tried<br/>
>><br/>
>> ^var1=(?i)(.*)(^5705)(.*)<br/>
>><br/>
>> but that didn't work...<br/>
> <br/>
> That's because the ^ is only negation in a character set, as when
you<br/>
> say [^aeiou] to mean "any character except the vowels".<br/>
> <br/>
> Probably the simplest way to do this is to have two regexes.<br/>
> <br/>
> if ( $line =~ /^var1=/ && $line !~ /5705/ ) {<br/>
> <br/>
> This says "If it starts with var1=, and it doesn't match 5705
anywhere",<br/>
> then $line matches.<br/>
> <br/>
> xoa<br/>
> --<br/>
> Andy Lester => andy@petdance.com => www.petdance.com =>
AIM:petdance<br/>
> <br/>
<br/>
<br/>
- - - -<br/>
"Wait for that wisest of all counselors, time." -- Pericles<br/>
"I do not fear computers, I fear the lack of them." -- Isaac
Asimov<br/>
"Soon we will be able to harness the rotational energy from Orwell's
grave to solve all world energy problems." -- /. user GigsVT
(208848)<br/>
GPG fingerprint:6FFD DB94 7B96 0FD8 EADF 2EE0 B2B0 CC47 4FDE 9B68