[Mailman-Users] Question about ban_list Regular Expression

Mark Sapiro mark at msapiro.net
Fri Nov 21 19:36:06 CET 2008

Barry Finkel wrote:

>I have a question about the ban_list regex.  In a reply on
>Tue, 24 Apr 2007 07:59:28 Mark Sapiro wrote
>>  So set Privacy options...->Sender filters->generic_nonmember_action
>>  to Accept so anyone can post and set Privacy options...->Subscription
>>  rules->ban_list to a regex that matches all addresses not in your
>>  domain. E.g.,
>>  ^.*@(?!example\.com)$
>>  or if you want to allow sub-domains within your domain
>>  ^.*@(.*\.)?(?!example\.com)$
>If I want subdomains of example.com and anl.gov to be able to
>subscribe (and to ban other domains), is this the correct regex for
>     ^(regex|regex)
>     ^(.*@(.*\.)?(?!example\.com)$|.*@(.*\.)?(?!anl\.gov)$)


The first problem is that my original regexps are wrong. I thought I
had tested them, but apparently I hadn't.

The simple domain without subdomains regexp should be


The domain with subdomains regexp should be


That said, the ORing of these regexps as in


or even


will always match because these match addresses that don't end with
something and if you OR together two different somethings, every
address doesn't end with at least one of them so every address matches.

You would need something like


(and I did test that this time)

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