Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How to define a list of regular expressions?

by poolpi (Hermit)
on Jul 02, 2009 at 07:32 UTC ( [id://776662]=note: print w/replies, xml ) Need Help??


in reply to Re: How to define a list of regular expressions?
in thread How to define a list of regular expressions?

See Regexp::Assemble

#!/usr/bin/perl use strict; use warnings; use Regexp::Assemble; my $ra = Regexp::Assemble->new->add(qw[foo bar baz]); print $ra->re, "\n"; for (qw[xfooy snork bar]) { print " $_ does " . ( /$ra/ ? '' : 'not ' ) . "match\n"; } __END__ Output: (?-xism:(?:ba[rz]|foo)) xfooy does match snork does not match bar does match


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-28 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found