\< and \> don't quite make it

Mike Peeler procl at list.z-concept.com
Tue Sep 12 23:28:08 CEST 2006

N.J. Mann <njm at njm.f2s.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

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

    * $ $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

More information about the procmail mailing list