Run the string through quotemeta before interpolating it into the regex, or use \Q$m\E.
In reply to Re: Usage of variables with special characters in regexp
by moritz
in thread Usage of avriables with special charachters in regexp
by ISAI student
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |