The \Q and \E are regex "quotes". That means characters with special meaning lose those meanings and become literal. If you want the user to be able to use regex special characters, just remove the \Q & \E.$pattern = shift; $file = shift; open(MAT, "<$file") or die "bad file name"; $text = <MAT>; while($text =~ /\Q$pattern\E/g) { $x += 1; } print "found $x matches\n"; close(MAT);
In reply to Re: regex patterns
by Cabrion
in thread regex patterns
by dogbert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |