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 

Reply via email to