mOrloff
01-21-2010, 07:22 PM
I am using this code:
$text=preg_replace('/\W/', ' ', $body); // strip all punctiation and non-word characters
But have come to realize that I need to keep the hyphens.
What is the easiest way to srtip all non-word characters except the hyphen?
Is there a way to make an exception for "-" while using \W, or some other direct way of doing it?
~ Mo
$text=preg_replace('/\W/', ' ', $body); // strip all punctiation and non-word characters
But have come to realize that I need to keep the hyphens.
What is the easiest way to srtip all non-word characters except the hyphen?
Is there a way to make an exception for "-" while using \W, or some other direct way of doing it?
~ Mo