procmail
[Top] [All Lists]

Extracting in an Alternation (Was Scoring Function Question)

1999-04-15 09:06:00
Philip Guenther suggested to Ralph Sobek,

|       :0:
|       *  9876543210^0 ^\/(From|Subject):.*Condition1
|       *  9876543210^0 B ?? ()\/Condition2
|       * -9876543210^0
|       * ! From:.*(Person1|Person2)
|       | (formail -z ...)
| 
| That way if either of the first two conditions match, procmail skip all
| the rest of the scoring conditions, including the third with its
| infemum weight.  If neither of the first two conditions matches then
| the third will cause procmail to skip the remaining conditions and fail
| the entire recipe.

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

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

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