procmail
[Top] [All Lists]

Re: \< and \> don't quite make it

2006-09-12 14:32:16
N.J. Mann <njm(_at_)njm(_dot_)f2s(_dot_)com> wrote:
Mike Peeler wrote:

You don't need to count, you only need to know if the filename occurs.

True for my example, but in the real recipe there are actually over 180
different pathnames.  I had never used scoring before and thought this
was a chance to give it a try.  It also seemed the easiest way of doing
a very long logical OR.

Scoring magic in wide use to do an OR:

    * 9876543210^0 ^Subject:.*\<ports/x11/xterm( |$)

As soon as the score goes off the top of the scale, it short-circuits.
To avoid re-grepping for the subject line 180 times, you could extract
the subject; while you're at it, you can shorthand the overflow score:

    GO = 9876543210

    SUBJ
    :0
    * $ ^Subject:(.*\<)?\/.*
    { SUBJ = $MATCH }

    :0
    * $ $GO^0 SUBJ ?? ()\<ports/x11/xterm( |$)

Looking over that incantation, I'm almost taken aback how many doodads
it uses.  But there's a real reason for every jot and tittle.

      *     ^Subject:.*\<ports/x11/xterm( |$)

This seems to work quite well: I haven't had any false positives so far
and have had lots of true positives since I switched to your suggestion.
Many thanks.

You're sure welcome.  -mdp


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail