[Top] [All Lists]

Re: procmail regex style using Or construct

2009-02-19 12:14:59
At 11:35 2009-02-19 -0500, Charles Gregory wrote:

* ^Date:.* (1|2|3|4|5|6|7) $MNTH $YR


* ^Date:.* [1-7] $MNTH $YR

Which should be noted is regexp for any one number that happens to be in the character range of 1-7. The same regexp WILL NOT work for "8-14" or "15-21" or whatever, so you're much better off sticking to the first syntax, which is clearer in meaning.

Scoring would be a way to utilize the day value directly (once extracted from the Date field, in a manner similar to my previously posted example).

Note: On some systems, to make $MNTH work, you need to insert
a backslash *after* the $ sign....

* ^Date:.* [1-7] $\MNTH $\YR


The $\variable syntax escapes characters with regexp meanings (of which there should be none in the month or year). What you want is a $ flag at the beginning of the recipe, to expand and evaluate variables found within the regexp:

* $ ^Date:.* [1-7] $MNTH $YR

(though I have a different regexp in the example I posted)

 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

procmail mailing list   Procmail homepage: