At 2002-02-19 22:25 -0600, David Douthitt wrote:
>On 2/19/02 at 6:25 AM, Mike Noyes <[EMAIL PROTECTED]>
>wrote:
> > OT: regexp question
> > BTW, is it possible to use a not bracket expression
> > against a string?
> > Here is an example that doesn't work. :-(
> >
> > 'Content-Type: .*[^\(plain\|signed\)]'
>
>The "(...|...)" construct is not recognized by much - I know egrep
>(grep -e) recognizes it, but grep does not.
>
>If you have UNIX in a Nutshell (worth getting!) look up the regexp
>section - in mine, that's one of the most commonly used parts. Not
>every regexp function is available everywhere there's regexps to be
>had (like vi, grep, egrep, sed...)
>
>Also, the way you've got it there, you are looking for anything that
>starts with:
<snip>
David,
I've done some homework, and discovered the following things: SF
lists.sf.net server uses Mailman 2.0.5, and Python 2.1.1. Mailman uses the
Python re module to parse regex in Privacy Options - Hold posts.
I believe I should be able to use the Python (?!...) negative lookahead
assertion to filter messages by content-type. However, I'm having some
difficulty generating the correct regex. Would you or someone else please
enlighten me? Thanks.
This regex string doesn't work.
Content-Type: .*(?!plain--signed)
Other ignorant attempts omitted.
I haven't tried this string yet.
Content-Type: .*(?!plain|signed).*$
The Mailman Python code for Hold posts is:
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 <[EMAIL PROTECTED]>
http://sourceforge.net/users/mhnoyes/
http://leaf.sourceforge.net/content.php?menu=1000&page_id=4
_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel