procmail
[Top] [All Lists]

Re: Conditional filtering of the body (and something else interesting)

2000-12-16 13:12:05
cory <cory(_at_)olga(_dot_)net> writes:
I want to perform filtering on the body of a message, depending on who
it's from.  Here's an example (that doesn't work) but demonstrates my
intentions:

CHUMS=(alice(_at_)domain\(_dot_)com|bob(_at_)domain2\(_dot_)com)

:0
* ^From:[       ]+.*$CHUMS
{
 :0 fbw
 | sed 's/bob/bumface/'
}

In reality the CHUMS line will be much longer (and of course I'll be
changing the filter :)).

The reason that doesn't work is that procmail doesn't expand variables
in condition lines unless the condition has the '$' special before the
regexp:

        :0
        * $ ^From:[     ]+.*$CHUMS
        ...

Note the plus after the "[      ]" is superfluous as the immeadiately
following ".*" will match spaces and tabs just as well.  Such
superfluous match possibilities slow down procmail's regexp engine.



Now for the interesting part:

I've been told that grep'ing for

(remove|removeme|removal)

is slower than something that looks more like

remov(e(|me)|al)

Is this really the case?  If so, has anyone written a script to
generate regexps like this, given a list of conditions?

Yes, this is the case.  I do not know of any program that does "regexp
glomming" (glomming is the opposite of globbing), though it shouldn't
be too hard for someone skilled in writing text manipulation programs.
Volunteers?


Philip Guenther
Procmail Maintainer
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>