procmail
[Top] [All Lists]

Re: ^^3^^

2002-10-28 20:06:31
At 16:48 2002-10-28 -0600, David W. Tamkin wrote:

However, I would advise against doing this:

  * $ -$SAVEDSCORE^0

because, if $SAVEDSCORE is already negative, procmail expands it to

 * --somenumber^0

I should perhaps have elaborated that one would only do this when working with a KNOWN positive which you were trying to invert. That's the only time I use a simple negation. The generic inversion which David presented makes a better no-brainer selections generic expression

* $ $VARIABLE^-2 HOST ?? ^^.|.^^

To answer dman's question about this expression:

In order to utilize the exponent, you need _multiple_ matches. The OR satisfies this by anchoring the wildcard match to the beginning and to the end of the string, against a variable which needs to be a non-null string anyway (it could be any variable which exists - so there's really no magic to the use of HOST here - that's probably what puzzled dman).

Remember, the FIRST match will add the weight to the score, and the SECOND match will add weight * exponent. Using something that limits the number of matches to two will ensure that you're getting w + w*-2, which is w*-1

So long as we don't end up with three or more (and the regexp ensures that), we don't end up with w*e*e and w*e*e*e, etc.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


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

<Prev in Thread] Current Thread [Next in Thread>