in reply to Re: regex search fails
in thread regex search fails
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/;
|
|---|