in reply to Quick Regex question

$one = "<HTML><Just testing this thing>"; $one =~ s/\W+/ /;
for all u people that wanted to see my test project thingamajig, here it is.

Replies are listed 'Best First'.
Re: Re: Quick Regex question
by swiftone (Curate) on Nov 18, 2000 at 02:59 UTC
    I'll post a nice verbose post to elucidate this for everyone not involved in the chatterbox:

    You wanted to replace all non-word characters with spaces. The pattern you listed wasn't working.

    The problem was that you didn't use the /g modifier, so it only replaced the first matching expression.

      In that case, I wouldn't use s/// at all. tr/// is faster and fits better, conceptually.

      tr/a-zA-Z0-9/ /c;

      I really like that /compliment switch.