procmail
[Top] [All Lists]

Re: Extracting in an Alternation (Was Scoring Function Question)

1999-04-15 11:07:44
Hello David!

"DWT" == David W Tamkin <dattier(_at_)Mcs(_dot_)Net> writes:

DWT> Philip Guenther suggested to Ralph Sobek,
DWT> |  :0:
DWT> |  *  9876543210^0 ^\/(From|Subject):.*Condition1
DWT> |  *  9876543210^0 B ?? ()\/Condition2
DWT> |  * -9876543210^0
DWT> |  * ! From:.*(Person1|Person2)
DWT> |  | (formail -z ...)

This works really great!!!

DWT> Heck, if it weren't for the extraction operator, we could combine the first
DWT> two:

DWT> * 9876543210 HB ?? 
^^(.+$)*((From|Subject):.*Condition1|$(.*$)*.*Condition2)

DWT> If "Condition1" and "Condition2" had been the same, we could manage it even
DWT> *with* the extraction.  The limitation is that you can't extract inside an
DWT> alternation (though you can alternate on either side of an extractor)  I've
DWT> occasionally wished it were possible, but changing it probably would break
DWT> something else (besides bloating the code).

The two Conditions ARE THE SAME!  Is your one-liner more efficient
than Philip's 3 line version?  I could be happy with just the
extraction before the Condition.  I suppose that the result would look
like:

* HB ?? ^^(.+$)*((From|Subject):.*Condition|$(.*$)*.*Condition)

Is this any more efficient?  On second thought, this would let through
`Condition' on other headers besides From or Subject!  And that is
bad!

Let's keep improving this thread.

Thanks to all the contributors,

        --Ralph