I need to remove all characters from a string which aren't a-z A-Z 0-9 or " ", anyone got a function to do this?
+11
A:
Sounds like you almost knew what you wanted to do already, you basically defined it as a regex.
preg_replace("/[^A-Za-z0-9 ]/", '', $string);
Chad Birch
2009-03-18 16:30:53
I know but I suck foot at RegEx, thanks dude!
zuk1
2009-03-18 16:33:17
+1
A:
Regular expression is your answer.
$str = preg_replace('/[^a-z\d ]/i', '', $str);
raspi
2009-03-18 16:41:24