[Top] [All Lists]

Re: procmail regex style using Or construct

2009-02-19 11:56:22
On Thu, 19 Feb 2009, Charles Gregory wrote:

On Thu, 19 Feb 2009, o(_dot_)nash(_at_)cs(_dot_)ucc(_dot_)ie wrote:
This egrep expression does the trick but does not translate to procmail.
egrep ^Date:.*\ \(1\|2\|3\|4\|5\|6\|7\)\ $MNTH\ $YR sent-mail

Um, it *should*. Perhaps the issue is that you are using the
backslash where you should not be using one. Procmail regex's
take the special characters ("(", "|", "[", et al) and give them their special meaning UNescaped. So in procmail the above regex would be:

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


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

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

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

- C

thanks very much for the very authoritative reply!
I was around in circles.
I tested all three of your suggestions
[ using Ubuntu 8.04 Linux with procmail v3.22 2001/09/10 ]

This is the only one that worked on my system
* ^Date:.* (1|2|3|4|5|6|7) $MNTH $YR

Thanks again

procmail mailing list   Procmail homepage: