$string = '|123456|john+'; /\Q$string\E/ # Strings are still interpolated, # but their contents are escaped.
$string = '|123456|john+'; /\Q$string/ # The \E is optional
/\Q|123456|john+\E/ # As long as the text doesn't # contain "$", "@", the regexp # delimiter (which is "/" here) # or \E.
$string = quotemeta('|123456|john+'); /$string/
In reply to Re: escape all special characters???
by ikegami
in thread escape all special characters???
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |