On 6/23/2011 3:38 AM, spixx_ wrote:
> Hello!
> I have started down the path of creating my own rulesets for a spamassassin
> install. My questions is simple. If I for instance want to match on sevral
> words how do I do that? 

SpamAssassin uses Perl regular expressions.  There is lots of
information available on the Internet.

    http://www.google.com/search?q=perl+regular+expressions

For your question, you can match on a list of words with an expression
like this:

    /word1|word2|word3|word4/

However, keep in mind that without anchoring the expression, you can
match on substrings such as "blahword1blah".  To avoid that, you can
match like this:

    /\b(?:word1|word2|word3|word4)\b/

The "\b" matches a word boundary (beginning or ending of a word) and the
parenthesis group the alternates together so that the expression says
"word boundary, one of these words, then another word boundary".  The
"?:" prevent the group from capturing the match and speeds it up a bit.

-- 
Bowie

Reply via email to