[Mailman-Users] topic regep exclude
msapiro at value.net
Sat Sep 25 02:06:43 CEST 2004
Howard Moscovitz wrote:
>In the topic definition form, how can one specify a topic that is only
>messages that DOES NOT have the string [G2] in it.
I would try
or if case is not significant
but this is only a suggested starting point. It seems to me that it
should work, but I don't know.
>Is there a way to test regeps without setting up a separte test list?
You could do a few interactive tests with Python or make a script.
[gpc_ms at clint ~]$ python2.3
Python 2.3.3 (#1, Mar 4 2004, 22:12:33)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> m = re.match('^(?!.*\[G2\])', 'now is the time for [G3] to do something')
>>> m = re.match('^(?!.*\[G2\])', 'now is the time for [G2] to do something')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'NoneType' object has no attribute 'group'
[gpc_ms at clint ~]$
In the first case, the re matches the null character at the beginning
of the line which is followed by not (anything followed by [G2]) so
the match succeeds and the matched string is null.
In the second case, the null character at the start of the string is
followed by (anything followed by [G2]) so the match fails and m.group
Mark Sapiro <msapiro at value.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users