Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 scrutinizing the Monastery: (3)
As of 2014-09-17 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls