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

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

by poolpi (Hermit)
on Jul 02, 2009 at 07:32 UTC ( #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


Comment on Re^2: How to define a list of regular expressions?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 06:17 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 (94 votes), past polls