[Mailman-Users] Regular Expressions

Mike Noyes mhnoyes at users.sourceforge.net
Thu Feb 21 19:23:05 CET 2002


At 2002-02-20 06:34 -0800, Mike Noyes wrote:
>What type of regexp does Mailman use in Privacy Options - Hold posts?

I think I found the answer after digging through the code.

It appears that the Python re module is used. Does this mean we can use the 
Python re module extensions in "Hold posts"?

ref.
http://www.python.org/doc/current/lib/re-syntax.html
http://py-howto.sourceforge.net/regex/regex.html

MailList.py
for line in string.split(self.bounce_matching_headers, '\n'):
     stripped = string.strip(line)
     if not stripped or (stripped[0] == "#"):
         # Skip blank lines and lines *starting* with a '#'.
         continue
     else:
         try:
             h, e = re.split(":[ \t]*", stripped, 1)
             try:
                 re.compile(e)
                 all.append((h, e, stripped))
             except re.error, cause:
                 # The regexp in this line is malformed -- log it
                 # and ignore it
                 syslog('config',
                        '%s - bad regexp %s [%s] '
                        'in bounce_matching_header line %s'
                        % (self.real_name, `e`, `cause`, `stripped`))
         except ValueError:
             # Whoops - some bad data got by:
             syslog('config', '%s - bad bounce_matching_header line %s'
                    % (self.real_name, `stripped`))
return all

--
Mike Noyes <mhnoyes at users.sourceforge.net>
http://sourceforge.net/users/mhnoyes/
http://leaf.sourceforge.net/content.php?menu=1000&page_id=4





More information about the Mailman-Users mailing list