<<< Date Index >>>     <<< Thread Index >>>

Re: regex 101 misunderstanding



* Jim <jimo@xxxxxxxxxx> [11-22-04 18:49]:
> The double backslash does, indeed work, but only if the pattern is
> found in the first portion of the header, not, as is nearly always
> the case on Received: headers, in the indented continuation portions.
> I did a bit more testing, and it seems the ``+'' character isn't the
> problem, the continued header is.  You can test the concept with
> any header; it doesn't have to be Received: to demonstrate the effect.
> 
> I'd have thought Mutt's ~h pattern specifier would have silently
> joined all the continuation lines into their respective headers (sort
> of analagous to formail's -c flag), but apparently not. 
> 
> So, I guess my question is really: How can we make a regex in Mutt
> that'll match things in those continued headers?

I do not know how to do it in mutt, but procmail springs to mind.
Procmail treats the header line as one continuous entity.  I believe
that I would use procmail to identify interesting posts and formail to
add an X-Header noting the particular interest, then use that header
for the mutt regex search.

something like (untested):

:0:
 ^X-Mailinglist:.*suse\-linux\-e        ## group of messages to search
 ^Received?.*jimmo\+blah                ## particular interest
 !formail -i "X-Interest: jimmo+blah"   ## header tag for mutt search

This recipe should only find messages addressed to the suse-linux-e
mailing list with a 'Received' header where you expressed interest and
then add a header "X-Interest: jimmo+blah", then deliver the message
to where-ever you have specified (could be added to the recipe).

then in mutt:
~h X\-Interest:.*jimmo\\+blah


After the initial setup, you would do no more/less that before, but
successfully.

gud luk,
-- 
Patrick Shanahan                        Registered Linux User #207535
http://wahoo.no-ip.org                        @ http://counter.li.org
HOG # US1244711           Photo Album:  http://wahoo.no-ip.org/photos