then $pattern doesn't contains a regexp pattern as its name implies. The variable should be renamedprint if /\Q$pattern\E/;
or quotemeta should be called earlier.my $search_str = $1; ... print if /\Q$search_str/;
my $pattern = quotemeta($1); # aka "\Q$1" ... print if /$pattern/;
In reply to Re^2: regex search fails
by ikegami
in thread regex search fails
by stephanm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |