[Mailman-Developers] Regexp filtering
Mark Sapiro
mark at msapiro.net
Sat Feb 27 00:20:01 EST 2016
On 02/26/2016 09:02 PM, Stephen J. Turnbull wrote:
> On Mailman-Users, Mark Sapiro writes:
>
> > Further, in the ban_list (and many other places in Mailman) if an
> > address is intended to be a regular expression pattern, it must begin
> > with '^', so you really want
> >
> > ^.*@domain\.com$
> >
> > to match any_address at domain.com.
>
> I hope we haven't propagated this rather user-unfriendly interface
> (the convention of accepting both regexps and literals, distinguishing
> by "^" in column 0) to Mailman 3. Even as a Python programmer, I find
> Mark's post somewhat confusing: I would design filters using
> re.search, so that the above would actually be equivalent as a Python
> regular expression to r"@domain\.com$". OTOH, if the implementation
> uses re.match, the "^" is redundant, so I have a "say what?!" event.
I agree it's confusing, and I've been caught in this confusion myself
and neglected to put the leading ^ in what I clearly intended to be a
regexp, but the convention goes back a long way in MM2.
> If we have, I propose changing it to
>
> Ban these addresses, one entry per line: [ ]
> [ ] Entries are regular expressions.
>
> or something like that. We also ought to have a "Python features for
> Mailman administrators" section of the FAQ, starting with "what is a
> regular expression", and giving examples of how to accomplish common
> tasks like banning a whole domain with regular expressions. Typical
> regexp FAQs are hard for non-programmers (and even beginning
> programmers) to grasp.
>
> I don't have time to actually work on these now, but if there's uptake
> on the suggestion ("let's think about it" at +0 or above :-) I'll file
> issues.
I'm not sure what the MM3 story is at this point, but +1 for Steve's idea.
--
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-Developers
mailing list