|
Posted by John Dunlop on 07/24/05 12:43
Randell D. wrote:
> However... I'm curious, the solutions provided, when used with
> preg_replace, would replace any of those characters, as opposed to
> replace anything BUT those characters... (ie I want to replace anything
> that is NOT alphanumeric or an underscore with a nospace...)
That's what they do, for differing values of 'alpha'. The ^
negates the character class, so [^a-z] matches everything
except a, b, c, ... z. [[:alnum:]] in addition to the decimal
digits can cover other letters. \W matches any non-word
character (word = letters, numbers and underscore, where
'letters' depends on your locale settings).
--
Jock
Navigation:
[Reply to this message]
|