Unfortionatly, that doesn't work.
s/\W|\s//g;
successfully does what it says it will - both:
s/\W//g;
and
s/\s//g;
thereby eliminating the whitespace that I wanted to preserve (both regular expressions do that, actually)
| [reply] [d/l] [select] |
Sorry, I misread your question the first time (me having
posted the first answer).. I think what you want is
$string =~ s/[^\w\s]//g;
| [reply] [d/l] |
Cool, that works. Thanks. The question now, though, is why? I know that:
/^\w/
will match any word character at the start of a line and that
/[]/ is character class stuff. Does the ^ actually negate or something similar instead of match the start of a line (in this context, of course)?
| [reply] [d/l] [select] |
Now that I know what to look for, I finally found the explanation
in man perlre . Ah, well. someday i'll read that in its entirerty.
| [reply] |