Do you have a question? Post it now! No Registration Necessary. Now with pictures!
September 12, 2007, 12:43 pm
rate this thread
Re: Regex help !!!!
$string = preg_replace('/[^a-z0-9 ]/i','',$string);
Allthough, depending on the exact yse, you might be better served with:
$string = preg_replace('/[^\w ]/i','',$string);
From the manual about '\w':
"A "word" character is any letter or digit or the underscore character, =
that is, any character which can be part of a Perl "word". The definitio=
of letters and digits is controlled by PCRE's character tables, and may =
vary if locale-specific matching is taking place. For example, in the "f=
(French) locale, some character codes greater than 128 are used for =
accented letters, and these are matched by \w."
- » Single cmd/bash session for all exec() calls - is this possible?
- — Previous thread in » PHP Scripting Forum