[Mailman-Users] Regular expressions in list config files?
Mark Sapiro
mark at msapiro.net
Sat Mar 1 02:01:17 CET 2008
bernholdtde at ornl.gov wrote:
>
>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.
That is correct.
>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.
It works for me. I just set a header_filter_rules regexp on a test list
to "^subject:.*hello.*$" with a reject action, and my test post with
Subject: test Hello in subject
was rejected with "Message rejected by filter rule match". In case
you're wondering, the Subject: was the 15th of 21 headers in the
message delivered to Mailman.
I then tested the regexp "^subject:\s+yes\s*$" with a post with
Subject: yes
and it too was caught.
>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".
That should be equivalent to "^x-spam-flag:\s+yes\s*$" in
header_filter_rules. Does the actual search in your SpamDetect.py say
if re.search(pattern, headers, re.IGNORECASE|re.MULTILINE):
>By the way, MM FAQ entry 3.32 and 3.51 are inconsistent about "^" and
>"$", and based on my experience 3.51 is wrong.
I have revised 3.32 which I think was the incorrect one, but we still
have to resolve why it works for me and not for you.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list