http://qs1969.pair.com?node_id=776662


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