Re: preg_replace newb

From: Date: Mon, 13 Oct 2003 13:00:36 +0000
Subject: Re: preg_replace newb
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-165973@lists.php.net to get a copy of this message
Mohamed, I still can't seem to get it working: <? $str = "<a href='somewhere/else.html'>foo</a>"; $str = preg_replace("!<a href='([^>]*)'>([^<]*)</a>!",'blah',$str); echo $str; ?> echo's '<a href='somewhere/else.html'>foo</a>' rather than 'blah' Justin On Monday, October 13, 2003, at 10:17 PM, Mohamed Lrhazi wrote:
I would try a petern like this: $pattern="!<a href='([^>]*)'>([^<]*)</a>!" check the docs for greedy not greedy thingy...


« previous php.general (#165973) next »