note 59535 modified in function.preg-match-all by colder
| From: | colder@php.net | Date: | Mon, 16 Apr 2007 17:00:45 +0000 |
| Subject: | note 59535 modified in function.preg-match-all by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125466@lists.php.net to get a copy of this message | ||
If you want to get a string with all the 'normal' characters, this may be better:
$clean = preg_replace('/\W+/', '', $dirty);
\W is the opposite of \w and will match any character that is not a letter or digit or the
underscore character, plus it respects the current locale. Use [^0-9a-zA-Z]+ instead of \W if you
need ASCII-only.
--was--
Re: webmaster at swirldrop dot com
If you want to get a string with all the 'normal' characters, this may be better:
$clean = preg_replace('/\W+/', '', $dirty);
\W is the opposite of \w and will match any character that is not a letter or digit or the
underscore character, plus it respects the current locale. Use [^0-9a-zA-Z]+ instead of \W if you
need ASCII-only.
http://php.net/manual/en/function.preg-match-all.php