in reply to RE: RE: RE: Re: How do you match
in thread How do you match

Don't do that with a single regex.

while( <FILE> ) { if( s/^confederation-as-router\:\W+\d\W+\d+\W// && ! /cr\d$/ ) { push(@file2, $_); } }

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
RE: (tye)Re: How do you match
by Adam (Vicar) on Sep 29, 2000 at 01:10 UTC
    Why not?
    while( <FILE> ) { push @file2, $1 if m/^confederation-as-router:\W+\d\W+\d+\W(?!.*cr\d ++)$/; }
    Although I bet you could improve on that further... reducing the .* to something more specific.

    Update: I missed the negation in that. oops. I've added it to my regex. Thanks runrig and Tye for pointing that out to me. (For those who missed it, I forgot the ?!)