$string = '(.asdf[0-9])$'; $foo = '(.asdf[0-9])$'; if ( $foo =~ m/$string/ ) { print "won't work\n"; } if ( $foo =~ m/\Q$string\E/ ) { print "will work\n"; }
In reply to Re: Sanitizing strings as regexes
by mr_mischief
in thread Sanitizing strings as regexes
by carenas2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |