in reply to Re: regexp exclude a string
in thread regexp exclude a string

#!/usr/bin/perl FILE: for my $file (glob '*.txt') { open my $fh, '<', $file or die "$file: D'Oh! $!\n"; while (<$fh>) { /(?=^(?:(?!green red blue).)*$).*?(green|red|blue)/i; do { print "$file \n"; next FILE; } if $1; } }

Replies are listed 'Best First'.
Re^3: regexp exclude a string
by blazar (Canon) on Jan 19, 2006 at 14:56 UTC

    (Any good reason why the shebang line is out of the code block?)

    If you find that more readable... but if you knew, then why did you need to ask in the first place? In the meanwhile your regex has grown complex enough and I tired enough not to even try and understand it. ;-)