| Welcome to WebmasterWorld Guest from 188.8.131.52 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Strip out non-alpha numeric|
I am looking for a php function that will efficiently strip from a phrase all characters that are not alpha or numeric:
keep only: a-z A-Z and 0-9
What might you recommend trying, other than the usual "RTFM"?
Thank you in advance
oh, also spaces are allowed
Do a preg_replace [nl2.php.net] of "/[^a-zA-Z0-9 ]/" with an empty string "".
Probably the pattern can be optimised, but this one should work for you.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved