procmail
[Top] [All Lists]

Re: double negatives

2003-08-12 11:52:38
On Tue, Aug 12, 2003 at 11:55:16AM -0500, David W. Tamkin wrote:

You're taking it out of context, Scott, as if it were in an unweighted 
recipe.  Consider the difference between these:

 * a

and

 * 1^1 a

The first one means "there must be an `a' in the head."  The second 
means, "score one point for every `a' in the head."  It's a difference 
of "whether at all" versus "how many times."

I understand the difference, but wanted you to concentrate on the
little HOST trick, which is why I pulled it out of context.

HOST, unless it is only 
one character long, will have exactly two matches to ^^.|.^^

I guess I'm still wondering why it won't match twice with a single
character, since the regex is split in to checking the start of the
string and the end of the string but not both together.

Say my hostname is 'a'. In my brayne, I would think (which obviously
is incorrect), that '^^.' would match 'a', because it's at the start
of the string and '.^^' would also match 'a' since the 'a' appears at
the very end of the string also. Can you explain why the regex doesn't
work on a single character (rather, where my understanding is lacking).

The first 
one will score $variable; the second one will score -2 x $variable.  The 
total will be -1 x $variable, whether $variable is positive or negative. 
 I tried it years ago, and it works.

That's very clever! I understand how if you could cause the condition
to trigger twice this works. Cool.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

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