procmail
[Top] [All Lists]

Re: Procmail regexp question

2016-10-25 04:58:44


On 18/10/16 00:03, Michael J Wise wrote:
I'd like to filter messages with one string but not another in the
,subject line.  For example, with "cat" but not "dog", so
        "Subject: My cat"
is accepted but
        "Subject: My cat hates dogs"
and
        "Subject: My dog"
        "Subject: My goat"
are not.
If Memory Serves...

*   ^Subject: .*cat
* ! ^Subject: .*dog

This solusion is not good because of the _AND_.   You say:
the subject contains "cat"  _AND_ not "dogs"  but the question ask for
"cat" and "dog"   _OR_    "cat"  only!

Try this:

*  2^0  ^Subject: .*\<cat\>
* -1^0  ^Subject: .*\<dogs*\>

If "cat",  score=2 (true)
If "dog",  score=-1 (false)
if "cat" and "dog",  score=1 (true)
if "caterpiler", score=0 (false)

--udi







Aloha mai Nai`a.

____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>