Re: ereg(_replace) help
| From: | Andrei Zmievski | Date: | Fri, 21 Jul 2000 21:53:26 +0000 |
| Subject: | Re: ereg(_replace) help | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7635@lists.php.net to get a copy of this message | ||
On Fri, 21 Jul 2000, Monte Ohrt wrote:
> I think I know the syntax for preg_replace(). You include everything in
> a character class [], and the leading ^ means a logic NOT.
>
> $string =
>
> preg_replace("/[^\w\d\+\!\@\#\$\%\^\&\*\(\)\[\]\{\}\\\|\;\:\'\"\,\.\<\>\/\?\+\=\~\`\_\-]+/","",
> $string);
>
> \w = word character
> \d = digit
>
> everything else is literal. Include each one you wan to keep, and make
> sure \- is last in the character class.
You don't need to backslash everything...
-Andrei
Nobody tried to design Windows - it just grew in random
directions without any kind of thought behind it.