Hi friends. Mailman 2.1.39, hosted by DreamHost. There's an anomaly happening in my spam filter rules: The filter rule reads: ^subject:.*spam* But it's catching the word "span" Like this, from a held message (it has also caught all the others in this thread): [1][1] Subject: RE: [RE-wrenches] Xantrex XW4548 lifespan Size: 17683 bytes Reason: Header matched regexp: ^subject:.*spam*
References
Michael Welch writes:
The filter rule reads: ^subject:.*spam* But it's catching the word "span"
That's correct. '*' in a Python regular expression means "zero or more of the preceding subexpression, in this case the letter "m" (more precisely, the character class "[Mm]" since we set the match to be case-insensitive).
If you want to catch the literal string "*spam*" anywhere in the subject, you need to escape the '*' with '\' like this:
^subject:.*\*spam\*
If that's not what you want, you'll have to tell us what you do want.
Steve
-- GNU Mailman consultant (installation, migration, customization) Sirius Open Source https://www.siriusopensource.com/ Software systems consulting in Europe, North America, and Japan
Thanks, Steve. Yes, that is what I want. Looks like I need to adjust some of my other filters too.
Stephen J. Turnbull wrote at 12:38 AM 4/12/2026:
The filter rule reads: ^subject:.*spam* But it's catching the word "span"
That's correct. '*' in a Python regular expression means "zero or more of the preceding subexpression, in this case the letter "m" (more precisely, the character class "[Mm]" since we set the match to be case-insensitive).
If you want to catch the literal string "*spam*" anywhere in the subject, you need to escape the '*' with '\' like this:
^subject:.*\*spam\*
If that's not what you want, you'll have to tell us what you do want.
Steve
Michael Welch wrote:
The filter rule reads: ^subject:.*spam* But it's catching the word "span"
Of course.
The filter matches a line
- beginning with "subject:"
- followed by zero or more characters of any kind ("." means "any character", "*" means "zero or more occurences")
- followed by the letters "spa"
- followed by zero or more times "m"
Subject: RE: [RE-wrenches] Xantrex XW4548 lifespan
- The line starts with "subject:".
- After that, there are zero or more characters of any kind, namely " RE: [RE-wrenches] Xantrex XW4548 life"
- After that, there is "spa".
- After that, there is no "m" (zero or more occurencens).
That's a match.
-thh
participants (3)
-
Michael Welch -
Stephen J. Turnbull -
Thomas Hochstein