Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: regexp exclude a string

by Murcia (Monk)
on Jan 19, 2006 at 14:34 UTC ( [id://524237]=note: print w/replies, xml ) Need Help??


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. ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://524237]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found