regexp matching question
Behdad Esfahbod
behdad-26n5VD7DAF2Tm46uYYfjYg at public.gmane.org
Fri Oct 7 13:50:05 UTC 2005
On Thu, 6 Oct 2005, Ian Zimmerman wrote:
>
> Behdad> I'm not sure what you exactly mean, but AFAIK, a new message is
> Behdad> started when the regexp "^From:" matches, and the header ends
> Behdad> when two consecutive new lines (Dos or Unix conventions) match.
> Behdad> What's wrong with that?
>
> It's "^From " , without the colon. These lines are, at least technically
> speaking, _not_ part of the header; they are added during delivery,
> reflecting the "envelope" return address (ie. the <MAIL FROM:> information
> from SMTP protocol), which can be entirely different from the contents
> of the From: header.
>
> This mechanism makes it necessary to escape occurences of this pattern
> within the message body; the usual convention is to change a leading "From "
> into ">From ". My guess is it's this escaping (and reverting it for
> final human consumption) that can be hard to get right in code and a
> source of possible subtle bugs, though in my experience formail is solid
> as a rock.
In fact many clients don't revert it back for viewing. I see
">From" at the beginning of the line all the time in my mailbox.
--behdad
http://behdad.org/
"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
-- Dan Bern, "New American Language"
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list