Re: ereg(_replace) help

From: Date: Fri, 21 Jul 2000 21:49:56 +0000
Subject: Re: ereg(_replace) help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7634@lists.php.net to get a copy of this message
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. Monte Ed Vul wrote: > > Uhm... I need to remove every funky character from a string except for > alphanumeric, and punctuation ... how would I do that. > I know I use erg_replace, but i don't know how to use that... > Can someone point me to a regexp tutorial somewhere? > > Thanks > Ed > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.general (#7634) next »