quick question about preg_replace

From: Date: Wed, 04 Oct 2006 21:19:58 +0000
Subject: quick question about preg_replace
Groups: php.general 
Request: Send a blank email to php-general+get-242621@lists.php.net to get a copy of this message
Hi all. I have written a guestbook (I know, there's a ton out there), which until recently did not get any spam, so now I'm trying to remove the spam-ad by using preg_replace: $melding = preg_replace('/(<a href=\"http:\/\/[^^]+)/i', "This message is temporarily cut-off due to spam-suspicion.", $melding); However, this only makes the problem half-solved, since I also want any text before the link to be replaced with a message as stated above. The above line removes anything after '<a href=//'. Is there any way to make the above line to include anything before the <a href=// ? I have tried different options, and yes, I have read the php manual on preg_replace, but I might not have properly identified how to get the text in front modified. Thankful for any hints, tips, links, anything that helps :-) Regards, Martin Bach Nielsen

« previous php.general (#242621) next »