[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Conditional filtering of the body (and something else interesting)
From:       Philip Guenther <guenther () gac ! edu>
Date:       2000-12-16 18:54:33
[Download RAW message or body]

cory <cory@olga.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@domain\.com|bob@domain2\.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@lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic