quick question about preg_replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux