Enclose the substitute in single quotes and substitute with the /e switch on.
It would be good practice to compile the regex with qr// before passing it as an argument. That way the caller can apply its own needs about escaping regex special characters.
After Compline,
Zaxo
In reply to Re: Regex as an argument to a sub
by Zaxo
in thread Regex as an argument to a sub
by Shaune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |