I cannot find suitable simple regular expressions to remove spam links. One I try to work, but only if www.example.com does not have a period and another offer next to it. I have a good book on regular expressions, but I just donβt have time to learn all this.
Here is the regex that I use. I honestly am not sure that I am even doing it right.
$a = $_POST['msge']; $b = preg_replace('^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$^', '[LINK REMOVED]', $a); print $b;
So, I was wondering if the code looks right, does anyone have a better regex that I could use?
source share