Re: Matching literal dot in To

Erik Christiansen <[email protected]> Sat, 13 Jun 2015 23:56:54 +1000
Newsgroups gmane.mail.procmail
Message-ID <20150613135654.GC3699@ratatosk>
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

-- 
Never worry about theory as long as the machinery does what it's
supposed to do.
                                                   - Robert A. Heinlein