my @regexs; !/^\s*$/ and push @regexs, $_ while <DATA>; my @smth = ("test_for r1", "+ test_for_r2 +"); $_ = eval for @regexs; for my $string (@smth){ for(@regexs){ $string =~ /$_/ and print "pattern \"$_\" is ok for \"$string\"$/" } } # STDOUT: # pattern "(?i-xsm:^\w+\s+\w+$)" is ok for "test_for r1" # pattern "(?i-xsm:^\W+\w+\W+$)" is ok for "+ test_for_r2 +" __DATA__ qr{^\w+\s+\w+$}i qr{^\W+\w+\W+$}i
In reply to Re: Exec'ing a regex stored in a scalar variable
by sh1tn
in thread Exec'ing a regex stored in a scalar variable
by brycen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |