UPDATE: It’s working! Thanks to everyone who made suggestions.
Also, as with any change to our filters, we’ve tried to be as careful as we can not to block innocent posts. But it’s always possible that I didn’t design or implement this quite right, and that it will inadvertently catch your innocent post. If it does, please let us know, as soon as possible. Thanks!
There is a famous blog-spam-bot which we particularly hate. It sends more spam than all of the rest of the spam world, combined. And it uses a set formula which I’d like to take advantage of. The bot draws from a list of 12 names and 16 domains, and all the spam it sends uses e-mail addresses constructed along this formula. I’d like to put in a regex instruction into our wp-comments-post.php file to keep out this bot. But I’m a terrible regex writer, and I can’t get it to work.
The bot’s formula (which I’ve learned through sad experience) is as follows: The names it uses are otard, napoleon, luba, johndoe, jane_doe, huy_lo, grey_goose, gocha, bushmills, azaddin, absolut, and absinth. The domains it uses are aol, yahoo, usmail, bigfoot, mail, tech, see, come, classnet, work, arrivo, does, rocketmail, |mainl, freemail, and hotmail.
Every spam that this bot sends (and it sends out hundreds a day) is built using those names, those domains, and a set of random digits after the name and before the @ symbol. So our most recent spams show the e-mail addresses:
Given the bot’s predictability, I’d like to run a command in my wp-comments-post.php file that runs a regex search on all comments and doesn’t let through the ones with a combination of that name and domain.
Here’s what I tried (which didn’t work):
// $regex = (otard|napoleon|luba|johndoe|jane_doe|huy_lo|grey_goose|gocha|bushmills|azaddin|absolut|absinth)[-w_.]*(aol|yahoo|usmail|bigfoot|mail|tech|see|come|classnet|work|arrivo|does|rocketmail|mainl|freemail|hotmail);
// if (@preg_match($regex, $email))
// die( __(‘Sorry, but some of the content of this comment appears to violate our comment policies. This determination has been made using filtering software. If you believe you have received this message in error, please contact us by e-mail as soon as possible. Thank you.’) );
It’s giving me a parse error when it hits the brackets. Does anyone know why that is? (Or better yet, does anyone know what I would need to put in to the wp-comments-post.php file to run that regex?)