|
Posted by Randell D. on 07/24/05 10:50
John Dunlop wrote:
> Tim Van Wassenhove wrote:
>
>
>>#[^a-z0-9_]#
>
>
> and #2 of the 100 ways to write that expression - probably
> *the* most common in c.l.php - involves + optimi[sz]ation
> (likely not appreciable though):
>
> #[^a-z0-9_]+#i <- case-insensitive, mind
>
> in at no. 3, the less explicit:
>
> #[^[:alnum:]_]+# //no need for 'i'; can match non-US-ASCIIs
>
> down at number 4, the shorter and even more implicit:
>
> #\W+# //as with 2, can match non-US-ASCIIs, no need for 'i'
>
> they're all different in their own inimitable ways.
>
Thanks to you both for the suggestions...
My internet access is limited at the moment but I will test this in a
few hours (when I have my LAMP machine)...
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...)
Thanks again for the help,
Randell D.
Navigation:
[Reply to this message]
|