in reply to Re: regex question
in thread regex question

you also don't escape characters in a character class.

That's not very good advice. Sometimes you certainly do need to escape characters in a character class. Take the following for example:

$ perl -le '$_ = q/f!o@o#b$a%r^b&a*z/; s/[!@#$%^&*]//g; print'

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^3: regex question
by Skeeve (Parson) on Oct 28, 2005 at 06:35 UTC
    Or, even more drastical, see the difference in these lines:
    perl -e '$_="bjzu-sbtz -abnzo-tbhze-rb zp-ebrzl- bhza-cbkze-r\n";s/[b-z]//g;print'
    vs.
    perl -e '$_="bjzu-sbtz -abnzo-tbhze-rb zp-ebrzl- bhza-cbkze-r\n";s/[b\-z]//g;print'

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e