Subject: Re: [PATCH 2/3] git send-email: do not ask questions when --compose is used.

From: Pierre Habouzit <[email-masked]>
Date: Sat, 01 Nov 2008 18:43:52 +0100

On Sat, Nov 01, 2008 at 05:34:32PM +0000, Francis Galiegue wrote:
> Le Saturday 01 November 2008 18:08:17 Pierre Habouzit, vous avez écrit :
> [...]
> >
> > To: John Doe <[email-masked]>, Random Joe <[email-masked]>,
> >   Superman <[email-masked]>,
> >   "Someone with a comma, inside its tag name" <[email-masked]>
> >
> 
> fg@erwin ~ $ cat t.txt
> To: John Doe <[email-masked]>, Random Joe <[email-masked]>, 
> Superman <[email-masked]>, "Someone with a comma, inside its tag name" 
> <[email-masked]>
> fg@erwin ~ $ <t.txt perl -ne 's,^To:\s*,,i; @mails = m/\s*((?:"[^"]+")?
> \s*<[^@]+@[^@]+>)\s*,?/g; END { print join("\n", @mails) . "\n"}'
> <[email-masked]>
> <[email-masked]>
> <[email-masked]>
> "Someone with a comma, inside its tag name" <[email-masked]>
> 
> That's regex, not especially perl ;)

Your regex fails to parse:

"Someone with a comma, and an escape double quote \" in its name"
  <[email-masked]>

That's why I first hinted at some MIME library that has probably made
that right.

Not to mention that you don't fix the multiline issue, but that is quite
less of a problem, it merely needs an accumulator and a 1 line lookahead
in the parser code while in the header parts. Nothing unrealistic for me
to write.

But I just can't resolve myself to parse anything with regex because I
just know it's horribly broken and wrong.

-- 
·O·  Pierre Habouzit
··O                                                [email-masked]
OOO                                                http://www.madism.org