procmail
[Top] [All Lists]

Re: Need regex-help: inverted word search

2004-11-05 16:14:36
At 20:45 2004-11-05 +0100, Andreas Schmidt wrote:
On 2004.11.05 19:39, Professional Software Engineering wrote:
At 19:10 2004-11-05 +0100, Andreas Schmidt did say:
        To: someone(_at_)server, myname(_at_)server, somebodyelse(_at_)server
Now I look for a way to do an inverse word search, like this:
        * To: (not myname)@server
I can look for specific strings:
(1)     * To:(_dot_)*myname(_at_)server

* ^To:(_dot_)*(_at_)server
* ! ^To:(_dot_)*myname(_at_)server
That doesn't work.

You could apply the multiple @server expressions in the first line, if you're looking for multiple cleartext recipients at your own domain, but not yourself.

I get the general impression that you're trying to determine if
multiple recipients at your domain are addressed.  Search the
Right, it's a number of accounts at the same domain, which makes it a
problem. A mail for
        To: someone(_at_)server, myname(_at_)server, somebodyelse(_at_)server
would match your first rule:
        * ^To:(_dot_)*(_at_)server
But because To always contains myname(_at_)server,
        * ! ^To:(_dot_)*myname(_at_)server
will never match.

Er, somewhere in there, I misread that you were looking for instances where your address DID NOT appear. My mistake.

The simplistic approach might be to do the following (this assuming the To: field is indeed what you're looking to match on):

:0
* ^To:\/.*
* -1^0
* 1^1 TO ?? @server
* -1^1 TO ?? myname(_at_)server

The first condition line extracts the contents of the To: header into a variable. The second sets the initial score to -1. The third condition uses scoring to add one point for each occurrence of the @server portion, while the fourth subtracts one for each occurrence of your own address in the variable. If the total is positive (meaning at least two more other address besides your own, or only one if your own address doesn't even appear), then the action part of the recipe will be acted upon. Obviously, you can add more conditions - say to _require_ that your address actually appear in the To: header, and that's easy enough.

procmail archives - I know I've submitted a recipe to score for
multiple recipients at a given domain (as well as variations on a
recipient name).
I'll try if I can find it....

<http://www.xray.mpe.mpg.de/mailing-lists/procmail/2002-06/threads.html>

Scan for "Scoring Recipe for repeating addresses"

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


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