Could someone lead me on finding a regular expression that blocks a comma separated list of Spam words I already have?
The regular expression needs to match a string with the spam word list I already have.
Not that it matters, but I am using PHP.
Try this:
\b(word1|word2|...)\b
The \b will match between a word character and a non-word character (so that the expression won't match if the words appear as part of a longer word).
You could generate a regular expression that matches anything containing a spamword from you list by replacing you commas with | and adding round brackets and word boundaries.
If your spamlist is "spam1,spam2,spam3", your regular expression would be "\b(spam1|spam2|spam3)\b".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With