[Mailman-Users] Spam detection issue

Stephen J. Turnbull stephen at xemacs.org
Sat Oct 12 08:42:46 CEST 2013


 > Hi Stephen,
 > 
 > Really thanks for the comprehensive answer. In my situation I'm using
 > following reg expression to catch spam.
 > 
 > X\-Spam\-Flag\: Yes.*
 > 
 > Is it wrong?

Maybe.  I forget the exact context, but in some places exact matches
and regular expressions can both be users.  In that case you need to
start a regular expression with '^'.

Aside from that, in Python regular expressions, you don't need the
backslash on the '-' or the ':'; they only have meaning as operators
inside a complex construct ('-' for ranges inside [] character
classes, and ':' as part of extension syntax for () groups).  Also,
there's no need for the ".*" at the end

I believe Mailman automatically makes the match case-insensitive.  The
only other thing I can think of is that it's legal to use TAB
characters (or none at all) between the ':' and the "Yes", so (as I
wrote before) I would write the expression as

^X-Spam-Flag:\s*Yes

 > I have a separate server for spamassasin and not using an extension like
 > you mentioned above.

OK, so the incoming mail should have the X-Spam-Flag in it, and this
regular expression should do what you want.

Steve


More information about the Mailman-Users mailing list