procmail
[Top] [All Lists]

Re: rules be or'ed instead anded

2001-09-29 00:51:32
Please do not reply to me privately on Procmail list postings, when the
content of your reply is of interest to the list.

On Sat, Sep 29, 2001 at 04:23:46AM -0300, Marcelo Ricardo Leitner wrote:
On Sat, Sep 29, 2001 at 12:04:33AM -0700, Andrew Edelstein wrote:
That's what the | does. That character (when used in a regexp) means, 
literaly "or".
---end quoted text---
yes.. but then to match a subject and a to field i would have to do:
* (^To:.*(email1|\
email2|\
email3)|\
^Subject:.*hi)

Wrong. That matches a Subject: OR a To:.
If you want to match a Subject: AND a To:, you would do:

* ^To.*(email1|email2|email3)
* ^Subject:.*hi

i would like to have just
* ^To:.*email1
* ^To:.*email2
* ^To:.*email3
* ^Subject:.*hi
got it?

Yes, I got it. What you would like to have and what you can have are two
different things.
What you don't "got" is that multiple conditions in a procmail recipe (where a
"condition" is a line beginning with "* ") are AND'd. To define paramaters
that are logically OR'd they must be in the same procmail condition. If you
would like to put each paramater on a seperate physical line, you will need to
use the line-continuation syntax procmail uses.

You could, if you REALLY wanted to, write this as

* ^To:.*email1|\
  ^To:.*email2|\
  ^To:.*email3|\
  ^Subject:.*hi

While this is perhaps VISUALLY clearer, it's AWFULLY redundant and efficiency
would probably suffer. 


This is without addressing the use of "To:.*" v. "TO" or "TO_", which is
another issue.



-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com
_______________________________________________
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>