RE: [PHP] str_replace question

From: Date: Wed, 10 Sep 2003 00:12:43 +0000
Subject: RE: [PHP] str_replace question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162124@lists.php.net to get a copy of this message
I think (and don't quote me on this, and feel free to correct me :) that preg_replace() is fast being based on perl regular expressions. ereg_replace() however, follows the POSIX standard for regular expression matching. Cheers, Rob. On Tue, 2003-09-09 at 17:36, Wouter van Vliet wrote: > $String = "<ques99>"; > preg_replace('/*\<[a-z]+)[0-9]+(\>)/', '$1$2', $String); > > will most likeley do. > > Btw, does anybody know why preg_replace is adviced over ereg_replace in the > manual? .. and if ereg_replace doesn't have any advantages over > preg_replace, couldn't this function get depricated? > > -> -----Oorspronkelijk bericht----- > -> Van: Al [mailto:news@ridersite.org] > -> Verzonden: dinsdag 9 september 2003 23:21 > -> Aan: php-general@lists.php.net > -> Onderwerp: [PHP] str_replace question > -> > -> > -> I've got a simple expression "<quesxx> where "xx" is a number > -> from 0 to 99. > -> > -> I want to replace it with simply <ques>. That is, I want to remove the > -> numbers. > -> > -> Will "str_replace" do it, or must I use ereg_replace? > -> > -> I haven't figured out from reading the php manual on regular expression > -> how to do this simple thing. > -> > -> Thanks.... > -> > -> -- > -> PHP General Mailing List (http://www.php.net/) > -> To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- .---------------------------------------------. | Worlds of Carnage - http://www.wocmud.org | :---------------------------------------------: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul. | `---------------------------------------------'

« previous php.general (#162124) next »