[Mailman-Users] Regexp topics

Mark Sapiro msapiro at value.net
Wed Dec 15 00:34:32 CET 2004


Enrique Vega wrote:
>
>How do you add multiple keywords to the Topics Section? I read the 
>simple instruction "Topic keywords, one per line, to match against each 
>message." However, when I do this, the topic does not work at all. If I 
>leave it as one word per topic, it works.
>
>Is there a regexp expression I should be using instead?

Yes.

I don't know what the "Topic keywords, one per line, to match against
each message." phrase is intended to mean, but here's what's going on.

The Regexp: box for the topic contains a single regular expression
which is compiled by re.compile() with the re.IGNORECASE and
re.VERBOSE flags. This means that both case and whitespace including
newlines will be ignored.

In other words, if you put

one
two
three

into the Regexp: box, this becomes 'onetwothree' and will only match
that exact string or one which is identical except for case.

If you wanted that topic to be a Subject: or Keywords: containing any
one of the words 'one', 'two' or 'three', you need to use the regular
expression 'one|two|three' which you could create for example by
putting

one|
two|
three

into the box or equivilantly

one
|two
|three

or just

one|two|three

Of course you could use a more elaborate regexp as well depending on
what you want, but however you enter it, it is just one regexp and the
newlines and other whitespace are ignored unless escaped or inside
character classes.

--
Mark Sapiro <msapiro at value.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