procmail
[Top] [All Lists]

Re: How do you 'OR' conditions

1995-12-21 13:32:12

From: Era Eriksson <reriksso(_at_)cc(_dot_)helsinki(_dot_)fi>
To: procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
Cc: pckizer(_at_)tamu(_dot_)edu, etlmcrt(_at_)etlxdmx(_dot_)ericsson(_dot_)se

On Wed, 20 Dec 1995 21:08:00 -0600, pckizer(_at_)tamu(_dot_)edu (Philip 
Kizer) wrote:
 > etlmcrt(_at_)etlxdmx(_dot_)ericsson(_dot_)se ("Marc Rackett (ETLMCRT 
XB/VAC)") wrote:
 >> As the condition lines are ANDED, is there an elegant
 >> solution to OR them?
 > To OR, you need to use the regular expression syntax for OR-ing (see the
 > procmailrc(5) man page for details):

Yes, well, from a mostly aesthetic point of view, I think it would be
helpful and certainly more intuitive if the following could be
rewritten as one rule with many OR cases:

My personal preference is to use weighted scoring:

:0
* -99^0
* 100^0 Condition-1
* 100^0 Condition-2
* 100^0 Condition-3
Action

to get the effect of Condition-1 OR Condition-2 OR Condition-3. Note
that these conditions don't just have to be regular expressions, they
can be length tests, shell conditions etc.

This method can even generalize to:

Condition-1 AND ...AND Condition-2 AND ( Condition-3 OR ... OR Condition-4 )

with

:0
* Condition-1
...
* Condition-2
* -99^0
* 100^0 Condition-3
...
* 100^0 Condition-4
Action

Unfortunately I can't see how to generalize this to an arbitrary
disjunction of conjunctions or conjunction of disjunctions. I'm not
sure, and semester is over so I don't think I'll try to prove it one
way or the other, but I don't think the scoring mechanism is powerful
enough to handle more than one independent disjunction.

I'm not sure what version of procmail this came in at, but certainly by
3.10 which is installed here.

nathan

----------------------------------------------------------------------------
Nathan Edwards                 as ci            Field of Operations Research
nedwards(_at_)orie(_dot_)cornell(_dot_)edu     imapofa      283 Engineering and 
Theory Center
                              ustrali                     Cornell University
#include <std.disclaimer>          a                         Ithaca NY 14853
----------------------------------------------------------------------------

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