Regex: Strip non alpha numeric or punctuation.
Posted
by Tedd
on Stack Overflow
See other posts from Stack Overflow
or by Tedd
Published on 2010-06-16T02:22:50Z
Indexed on
2010/06/16
2:32 UTC
Read the original article
Hit count: 277
How can I use PHP to strip out all characters that are NOT alpha, numeric, space, or puncutation?
I've tried the following, but it strip punctuation.
preg_replace("/[^a-zA-Z0-9\s]/", "", $str);
© Stack Overflow or respective owner