Re: ereg(_replace) help

From: Date: Fri, 21 Jul 2000 23:22:16 +0000
Subject: Re: ereg(_replace) help
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-7645@lists.php.net to get a copy of this message
How would I capitalize the first character of a string? so anyting would become Anything Hat would remain Hat , etc... John <rasmus@lerdorf.on.ca> wrote in message news:Pine.LNX.4.21.0007211456500.891-100000@thinkpad.php.net... > Would be easier to use: > > $new = ereg_replace("[^[:alnum:][:punct:]]","",$str); > > Check the regex.7 man page in the regex dir of the PHP distibution source > code. > > -Rasmus > > 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. > > > > 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/ > > > > > > > -- > 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 >

« previous php.general (#7645) next »