in reply to Regexes that use a string as basis for matching
If $pattern_str is plain text and not a regular expression, you'll need to convert/escape it before you can use it as a regular expression.
or$str =~ /\Q$text\E/
ormy $re = quotemeta($text); $str =~ /$re/
index($str, $text) >= 0
References:
perlre (for regular expressions in general and \Q..\E specifically)
quotemeta
index
|
|---|