On Mon, Oct 13, 2003 at 11:00:36PM +1000, Justin French wrote: : : 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... : : 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, Your code snippet works for me. My output says "blah". :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php