« Return to Thread: spamassassin rule set issue

Re: spamassassin rule set issue

by Martin Gregorie-2 :: Rate this Message:

| View in Thread

On Tue, 2012-04-17 at 15:18 +0200, Tom Kinghorn wrote:

> > /\borange\b/i is what I'd use.
> >
>
I should have added that the latest versions of grep understand Perl
regex syntax, which can be useful for rapidly checking regexes before
writing an SA rule. The main difference is that the regex should be
enclosed in single quotes rather than forward slashes and the 'm' prefix
used by Perl to change the regex delimiters isn't understood and nor is
the /../i suffix. For example I was able to very rapidly run through the
suggestions for this case by using something like

        grep -iP '\bOrange\b' <words.txt

where the -P option says that the regex is in Perl syntax, the -i option
sets case insensitivity and word.txt contains:

a line
Orange
an Orange
a drink of Orangeade now
a final line

Beware that the grep man page says "This is  highly experimental and
grep -P may warn of unimplemented features." IOW using grep is only the
first step in developing a rule. You should still check the completed SA
rule against both ham, spam and (preferably) edge cases to make sure it
does no more and no less than you want it to do.


Martin





> >
> > Martin
> >
> >
> Noted.
>
> Thanks Martin.


 « Return to Thread: spamassassin rule set issue