in reply to Re: It seems simple...
in thread It seems simple...

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)

Replies are listed 'Best First'.
RE: RE: Re: It seems simple...
by plaid (Chaplain) on Feb 24, 2000 at 11:42 UTC
    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;
      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)?
      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.