[Mailman-Users] OT - Regex help (was: Re: About Spam Filtering

Joseph Brennan brennan at columbia.edu
Sat Feb 16 15:54:07 CET 2013

--On Saturday, February 16, 2013 8:08 AM -0500 Tanstaafl 
<tanstaafl at libertytrek.org> wrote:

> On 2013-02-15 10:25 AM, Joseph Brennan <brennan at columbia.edu> wrote:
>> elsif
>> (/^from:.*+(bounce|do-not-reply|facebook|linkedin|list-|myspace|twitter)
>> /i) { $logger->debug("Multi-string From header matching $1: $2 found;
>> exiting"); exit (0); }

> This 'if' block is just a bunch of separate one line tests that, if any
> of them match, result in the vacation response not being sent, so it
> doesn't really matter what is above them (they are all the defaults, this
> is the only line I am modifying)...

Not exactly. If you chain them with elsif then the conditions are tested
in order until one matches, and any after that are not tested. If one of
the earlier conditions matched then your rule would never match.

Remove the + mark (and learn what .* means) and you're probably done.

In the debug statement, $1 will be the string in ( ) that matched, but
$2 is not defined since there is no other ( ) string.

Joe Brennan

More information about the Mailman-Users mailing list