[Mailman-Users] Regular expressions in list config files?
bernholdtde at ornl.gov
bernholdtde at ornl.gov
Sat Mar 1 00:21:47 CET 2008
Okay, it looks like the header_filter_rules are getting set correctly
through all interfaces, including the web u/i -- I have been unable to
reproduce the errors I had initially observed with escaping of
backslashes. Perhaps I got my tests muddled.
I've also spent some time figuring out why even the simplest regex I
could think of wasn't matching as I thought it should. I instrumented
Handlers/SpamDetect.py to watch what was going on.
Here's the result: In applying header_filter_rules, it looks like the
entire set of headers is being treated as a single multiline string.
For reasons I don't entirely understand (remember I'm not a python
expert), "^" and "$" are not matching the beginning and end of
individual lines of a multiline string, even though I interpreted
http://www.python.org/doc/current/lib/matching-searching.html to say
that they should, and a colleague who's very familiar with Python also
thought they should.
If I don't have the line beginning/ending constraints in the regex,
there is a risk (albeit small) that a subject header could match. So
I ended up with "\nx-spam-flag:\s+yes\s*\n".
By the way, MM FAQ entry 3.32 and 3.51 are inconsistent about "^" and
"$", and based on my experience 3.51 is wrong.
Thanks for your help.
--
David E. Bernholdt | Email: bernholdtde at ornl.gov
Oak Ridge National Laboratory | Phone: +1 (865) 574 3147
http://www.csm.ornl.gov/~bernhold/ | Fax: +1 (865) 576 5491
More information about the Mailman-Users
mailing list