Re: Matching literal dot in To

Moby <[email protected]> Sat, 13 Jun 2015 18:21:41 -0500
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>

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 [email protected].
>> 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: "[email protected]" <[email protected]>

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