Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(ar0n) Re (3): Need help comparing against a set of regexps

by ar0n (Priest)
on Mar 10, 2002 at 07:40 UTC ( #150687=note: print w/ replies, xml ) Need Help??


in reply to Re: (ar0n) Re: Need help comparing against a set of regexps
in thread Need help comparing against a set of regexps

qr was added in Perl 5.005_03. If you're running anything older than that, you should consider an upgrade, as previous versions are considered buggy.


my @regexes = ('HELLO(\w+)', 'hello(\w+)', 'Hello(\w+)'); for my $re (@regexes) { $re =~ s!/!\/!; # escape delimiters my $eval = '$string =~ /' . $re . '/;'; if ( eval $eval ) { print "$string matches $re\n"; } }
It's an ugly hack, and I would very much prefer it if you would promote world peace, fight hunger and help stop global warming by upgrading your version of Perl.

[ ar0n -- want job (boston) ]


Comment on (ar0n) Re (3): Need help comparing against a set of regexps
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2015-07-30 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls