procmail
[Top] [All Lists]

Re: How do you 'OR' conditions

1995-12-21 09:33:05
Era Eriksson <reriksso(_at_)cc(_dot_)helsinki(_dot_)fi> wrote:
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:

I can hardly imagine a good (and readable!) regexp to handle these in
one rule. 

How's this for a change?

    :0
    * ^(Subject: .* FREE |\
        To: liu-lysator-runeberg(_at_)uunet(_dot_)uu(_dot_)net|\
        From: Ecstasy(_at_)euphoria(_dot_)com)
    spam~

             # The installed procmail is a very old one, can't use :0

In that case, pervert the above to:

    :1
    ^(Subject: .* FREE |\
To: liu-lysator-runeberg(_at_)uunet(_dot_)uu(_dot_)net|\
From: Ecstasy(_at_)euphoria(_dot_)com)
    spam~

 For one thing, adding a new case would entail adding a whole new
rule, which means four new lines to an already unfocused piece of
code. 

Once could always write in a macro language and generate the .procmailrc
file from there.  Then again, when procmail supports functions, this
becomes easier to do as well.

 (And then they'll ask for a mechanism to OR ANDed ORs ;^)

And they do.
-- 
Sincerely,                                                          
srb(_at_)cuci(_dot_)nl
           Stephen R. van den Berg (AKA BuGless).

"And now for something *completely* different!"

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