Re: Stripping Characters

From: Date: Tue, 22 Jun 2010 16:13:37 +0000
Subject: Re: Stripping Characters
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-306311@lists.php.net to get a copy of this message
Perhaps, ereg_replace("your regex", "replacement_string", String $variable). Regards, Shreyas On Tue, Jun 22, 2010 at 9:10 PM, Rick Dwyer <rpdwyer@earthlink.net> wrote: > Hello List. > > I need to remove characters from a string and replace them with and > underscore. > > So instead of having something like: > > $moditem = str_replace("--","_","$mystring"); > $moditem = str_replace("?","_","$mystring"); > $moditem = str_replace("!","_","$mystring"); > ....etc. > > For every possible character I can think of, is there a way to simply omit > any character that is not an alpha character and not a number value from 0 > to 9? > > > --Rick > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Shreyas Agasthya

« previous php.general (#306311) next »