procmail
[Top] [All Lists]

Re: procmail regex style using Or construct

2009-02-20 00:34:50
Sean wrote,

An alternative is to use scoring - let procmail track the numerics AS
numerics.

That was my first thought, though from the other end opposite Sean's view: I would start with a score of -28 and then add $MATCH. Positive would mean week 5; else add 7 and positive then means week 4; else add 7 and positive then means week 3, etc.

Then it occurred to me that one can get an integer quotient out of procmail, but I could not remember the syntax. It involved scoring and size tests. It went something like [please don't hold me to this, as I am sleepy and do not have the procmailsc(5) man page available; it definitely is possible but I may have the syntax wrong],

SEVEN=1234567 # any seven-character string
# MATCH at this point is the date within the month
:0
* $ SEVEN ?? 1^1 < $MATCH
{ WEEK = $= }

A modification of that -- substitute a comparable modification of the way the foregoing should have read if it was wrong -- would be,

DOT=.
:0
* $ DOT ?? 7^1 < $MATCH
{ WEEK = $= }

____________________________________________________________
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