If you want to remove spam links from your blog comments or from your site use the following snippet:

$string = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $string);
 

Leave a Comment

You must be logged in to post a Review.