Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: leaving only [a-zA-Z0-9]

by neniro (Priest)
on Mar 21, 2004 at 13:58 UTC ( #338451=note: print w/replies, xml ) Need Help??


in reply to leaving only [a-zA-Z0-9]

you can also use $a =~ s/\W//g;

If you use locales; it supports special chars too.

Replies are listed 'Best First'.
Re: Re: leaving only [a-zA-Z0-9]
by Happy-the-monk (Abbot) on Mar 21, 2004 at 14:18 UTC

    you can also use $a =~ s/\W//g;

    make that   s/[\W_]//g;   to take away the   _   too.

    And careful with   locale!   That will not get rid of Umlauts and word characters with accents and such. It will still get rid of special characters though.

    Sören

      "That will not get rid of Umlauts and word characters with accents and such." - that are the specialchars I've meant.
      Sorry I should have been more detailed in my explanation.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://338451]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2017-10-21 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (269 votes). Check out past polls.

    Notices?