Regular Expressions and RFC 822
Tim Roberts
timr at probo.com
Mon May 20 02:45:43 EDT 2002
"alex gigh" <cogs2002 at hotmail.com> wrote:
>
>I am trying to write a mail server in Python and I found out that I can use
>regular expressions and then grouping:
>
>"For example, an RFC-822 header line is divided into a header name and a
>value, separated by a ":". This can be handled by writing a regular
>expression which matches an entire header line, and has one group which
>matches the header name, and another group which matches the header's value.
>"
That's not exactly true. RFC-822 header lines are often continued onto
multiple lines. A line following a header that starts with whitespace is
automatically a continuation of the previous line:
Subject: This is a rather unusual
but perfectly legal
subject line that could not
be easily parsed with a simple regular
expression.
To: "Joe Cool"
<jcool at snoopy.com>,
"Charlie Brown"
<kicker at snoopy.com>
When you say you are writing a mail server, what do you really mean? Are
you writing a mail CLIENT, or are you actually writing a mail transfer
agent like sendmail?
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list