[Mailman-Users] Regexp for blocking addresses
Matthew Saltzman
mjs at clemson.edu
Fri Sep 25 19:03:21 CEST 2015
On Fri, 2015-09-25 at 08:23 -0700, Mark Sapiro wrote:
> On 9/25/15 7:57 AM, Matthew Saltzman wrote:
> >
> > That's still much more aggressive than what I was trying to say. I
> > actually want to ban precisely all variants of the one address
> >
> > joeblow at gmail.com
> >
> > (and about a dozen other addresses) that include embedded periods
> > anywhere and the suffix, but not other gmail addresses. grep finds
> > them with
> >
> > \.\?j\.\?o\.\?e\.\?b\.\?l\.\?o\.\?w\.\ ?+.*@gmail \.com
> >
> > (I might want \.* instead of \.\?) but adding
> >
> > ^\.\?j\.\?o\.\?e\.\?b\.\?l\.\?o\.\?w\.\ ?+.*@gmail\.com
> >
> > to the ban list doesn't seem to block them.
>
>
> Because in a python RE, \? is a literal '?', not a '0 or 1 of
> repeat'.
> For grep you need the \? to give ? its special meaning. a regexp for
> egrep or grep -E will be closer to what you want for python. You want
>
> ^\.?j\.?o\.?e\.?b\.?l\.?o\.?w xxx \+.*@gmail\.com
>
> where I'm unsure about the ' xxx ' part because I don't understand
> what
> '\ ?' is supposed to do?
Just a formatting mistake.
>
> Or instead of the above and to account for multiple '.' maybe
>
> ^\.*j\.*o\.*e\.*b\.*l\.*o\.*w\.*\+.*@gmail\.com
>
> which says zero or more dots followed by j followed by zero or more
> dots
> followed by o, etc., followed by w followed by zero or more dots
> followed by + followed by anything followed by @gmail.com.
>
> See <
> https://docs.python.org/2/library/re.html#regular-expression-syntax>.
I think that's what my problem is. Will give it a try.
Thanks very much.
>
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
More information about the Mailman-Users
mailing list