procmail
[Top] [All Lists]

Re: Matching literal dot in To

2015-06-14 19:43:57


On 06/14/2015 07:31 AM, Ruud H.G. van Tol wrote:

On 2015-06-14 11:38, Erik Christiansen wrote:
On 13.06.15 18:21, Moby wrote:

Thanks.

This seems to suffer from the same issue that my simplistic recipe
suffered from.  Using the same email, here is the recipe I used
together with the log snippet:

To header from email:
To: "gamestop(_at_)abc-def(_dot_)com" <gamestop(_at_)abc-def(_dot_)com>

Recipe:
:0w
* ^TO_.*\<[^.@]+\.[^.@]+@

Ah, yes, the unanticipated match is due to allowing a match across ' '.
We need another tweak. This will be a great deal closer:

    * ^TO_.*\<[^.@ ]+\.[^.@ ]+@

That will not leap to the end of a mismatched address, but slide off it
in stages, because '\<' is only shorthand for `[^a-zA-Z0-9_]'. But we
needn't fuss over a lost microsecond here or there. It should do the job
now.

Indeed, no win possible anymore.

If you also want to log which address matched, try this:

* ^TO_.*\<\/[^.@ ]+\.[^.@ ]+@[^, ]+


BTW, I see more and more UTF-8 encoded email addresses.
https://en.wikipedia.org/wiki/International_email

Many thanks Rudd, the last recipe works perfectly. I tested it with multiple addresses and various other combinations I could think of and it worked just as desired. Thanks again.

--
--Moby

They that can give up essential liberty to obtain a little temporary safety 
deserve neither liberty nor safety.  -- Benjamin Franklin

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