procmail
[Top] [All Lists]

Re: Matching literal dot in To

2015-06-13 18:22:12


On 06/13/2015 08:56 AM, Erik Christiansen wrote:
On 13.06.15 12:58, Ruud H.G. van Tol wrote:
On 12.06.15 21:14, Moby wrote:
Chuck, the goal is to put the message in a particular folder if ~any~
of the addresses in the To field is of the form abc.def@some.domain.
Why call external processes like formail and egrep?
To process the "To:" header line _without_ anchoring the regex, so that
the stated goal can be met. (But mostly because the first workable
solution that comes to mind is sufficient if it does the job. :-)

Try this:

:0
* ^To:.*\<[^.@]+@
particular_folder

or use a macro:

:0
* ^TO_.*\<[^.@]+@
particular_folder
Err, how does that find xxx.yyy@zzz in any of many addresses on the
line?

But following your lead back into procmail regexes, so long as the .*
matches up until _all_ of the rest matches, then this may do the trick:

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

That'll find a match in an nth address so long as the regex engine backs
into .* all partial matches until a full match is found. Should do.

Erik

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_.*\<[^.@]+\.[^.@]+@


Log:
procmail: Match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?).*\<[^.@]+\.[^.@]+@"

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