> 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
------------------------------------------------------
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to