you also don't escape characters in a character class. your regex (once g is added for global) will strip back slash characters, as well as braces.No, it doesn't. There's no need to escape the parens, but it certainly doesn't do any harm:
No backslashes are removed.$_ = 'foo\bar(baz)'; print "Before: '$_'; "; s/[\(\)]//g; print "After: '$_'\n"; __END__ Before: 'foo\bar(baz)'; After: 'foo\barbaz'
In reply to Re^2: regex question
by Perl Mouse
in thread regex question
by lepetitalbert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |