note 40791 deleted from function.preg-replace by didou
| From: | didou@php.net | Date: | Mon, 15 Mar 2004 07:20:20 +0000 |
| Subject: | note 40791 deleted from function.preg-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66849@lists.php.net to get a copy of this message | ||
Note Submitter: mateo@cleverdick.com
----
For all the people out there that don't understand a single bit of this regular expression
replacement stuff (including myself), and just want to take a string and remove all special
characters from it, leaving it with only spaces, underscores, letters, and numbers...here is the
code!
$string = preg_replace('/[^\w\s\-]/','',$string);
To tell you the truth, I don't completely understand it but I did some research and mixed perl
with php and it works and that's all that matters.