procmail
[Top] [All Lists]

Re: egrep matches, but procmail recipe not

2015-08-16 09:29:09
On 2015-08-16 11:06 +0200, Eric Smith wrote:

The following (negative) procmail patterns do not match:

:0:
* ! ^(Subject|From):.*sunglas
* ! ^(Subject|From):.*Sunglasses
* ! ^(Subject|From):.*Oakley
* ! ^(Subject|From):.*Ray*Ban
* ! ^(Subject|From):.*?utf-

procmail logs:
procmail: Match on ! "^(Subject|From):.*sunglas"
procmail: Match on ! "^(Subject|From):.*Sunglasses"
procmail: Match on ! "^(Subject|From):.*Oakley"
procmail: Match on ! "^(Subject|From):.*Ray*Ban"
procmail: Match on ! "^(Subject|From):.*?utf-"

However, when I test with egrep for a (positive) match with these
patterns, then they do match.

$ cat test_patterns
^(Subject|From):.*sunglas
^(Subject|From):.*Sunglasses
^(Subject|From):.*Oakley
^(Subject|From):.*Ray*Ban
^(Subject|From):.*?utf-

$ egrep -i -f test_patterns rayban.mail
From: "RayBan Sunglasses" <service(_at_)uqmpkfx(_dot_)com>
Subject: =?utf-8?B?UmF5QmFuIFN1bmdsYXNzZXMgIiA=?=
From: "RayBan Sunglasses" <service(_at_)zvzlxaw(_dot_)com>
Subject: =?utf-8?B?UmF5QmFuIFN1bmdsYXNzZXMgIiA=?=

Is rayban.mail a valid email message, and do these lines occur in its
header?  By default procmail recipe conditions only search the header,
the body is ignored.  This can be changed with the B flag.

Since grep -f searches for _any_ of the patterns in the file, it would
help running it with one pattern at a time, so you know which one
actually matched.  As it is you don't know.

Lastly, some of the patterns probably don't do quite what you want.  ?
is an extended regexp metacharacter, and Ray*Ban matches RaBan but not
RayxxxBan.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.

____________________________________________________________
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