grep { $string =~ /$_/ } @regex;
and if you don't need to count how many matches occured than you can speed up that code:
Updated: (thx to Anomalous Monk)
sub is_match { grep { $string =~ /$_/ and return 1 } @regex; } if ( is_match() ) { print qq($string matched some regex); }
In reply to Re: Matching an array of regexes (grep in reverse)
by ccn
in thread Matching an array of regexes (grep in reverse)
by raymor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |