procmail
[Top] [All Lists]

Re: or statements

2003-09-14 10:27:26
Some time around 9/14/2003 12:19:37, I think I heard Klaus Johannes Rusch say:
Manojav Sridhar wrote:

i am writing th following recipie.

:0:
* ^(From).*senderID@ | ^(From)(_dot_)senderID2(_at_)* | 
^(From)(_dot_)senderID3(_at_)*
sender

:0
* ^From: (senderID|senderID2|senderID3)@
sender

That is definitely the best way to do it.  If that satisfies you, then
fine, but in case you are curious as to why it doesn't work and want
to learn from your mistakes, then read on.

The reason it doesn't work is because of the spaces between the ORs
'|', i.e. procmail is trying to match '^(From).*senderID@ '.  I also
think (please someone correct me if I'm wrong) that procmail will OR
the immediate strings surrounding it, in your case, the spaces.  So
instead of trying to find 1 of 3 expressions, it is trying to match
something like:

From: senderID@
From SenderID2@
From senderID3@

(Notice that its looking for 3 lines because it is trying to match one
single string containing all those expressions, but each 'From' at the
beginning of a line.)  Obviously this is not what you want.  To fix
it, you might want to group the expressions with parens and remove the
spaces.  Also, in the final 2 expressions, you are only allowing one
character after the 'From' string (no *), so this will not match
'From: '.

Not that you should use do this, but this would work:

* 
(^From.*senderID@)|(^From(_dot_)*senderID2(_at_)(_dot_)*)|(^From(_dot_)*senderID3(_at_)(_dot_)*)

As an alternative comparison string, you can use:

* ^From.*senderID[1-3]?@

This allows for senderID, senderID1, senderID2 and senderID3.

        dZ.

-- 
:[ DZ vs. THE WORLD]==- -- -  -

Hating anything, everything and everyone since 1996.
-- 


_______________________________________________
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>