my $regexStr="^static\s+\w+\s+(" # Thanks moritz! . (join "|",map quotemeta,@names) . ")\W.*)"; while(<STDIN>) { chomp; if(/$regexStr/) { # rest is the same as your "optimized" # attempt
Edit: added map quotemeta as suggested by moritz
In reply to Re: RegExp to Search All Array Members?
by RMGir
in thread RegExp to Search All Array Members?
by shoness
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |