procmail
[Top] [All Lists]

Re: capturing the OR that succeeds ???

2004-05-14 05:32:41
Toen wij Dallman Ross kietelden, kwam er dit uit:

Okay, that's enough for this round, I hope.

I was missing an incarnation. Because most mail won't match, 
do the optimal test for that first.

  :0D
  * B ?? ()\/(aaa|bbb|ccc|ddd|eee)
  {
     :0 D fw h
     * B ?? 9876543210^0 ()\/aaa
     * B ?? 9876543210^0 ()\/bbb
     * B ?? 9876543210^0 ()\/ccc
     * B ?? 9876543210^0 ()\/ddd
     | formail -I "X-Procmail: alphabet soup: $MATCH"

     :0 A
     alphabet/soup
  }


If a headers-only-test applies to the situation at hand, 
insert that before the first (outer) condition. 


The complexified version:

  MATCH = "eee"
  :0D
  *$ B ?? (aaa|bbb|ccc|ddd|$MATCH)
  {
     :0 D fw h
     * B ?? 9876543210^0 ()\/aaa
     * B ?? 9876543210^0 ()\/bbb
     * B ?? 9876543210^0 ()\/ccc
     * B ?? 9876543210^0 ()\/ddd
     | formail -I "X-Procmail: alphabet soup: $MATCH"


     :0 A
     alphabet/soup
  }

-- 
Grtz, Ruud

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail