Thread: Using regex
View Single Post
Old 07-20-2009, 01:56 AM   #1 (permalink)
benton
The Contributor
 
Join Date: Apr 2008
Posts: 78
Thanks: 0
benton is on a distinguished road
Default Using regex

The following code, the way I understand it, is supposed to strip all punctuation characters from the string. From what I've found on the web, a space is not one of those characters. But the code below outputs "abstractmodern." Would someone please explain how I can strip all special characters except the spaces?
PHP Code:
$pattern "([[:punct:]])"
$str "abstract modern"
$str ereg_replace($pattern''$str)); 
echo 
$str
benton is offline  
Reply With Quote