[PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line
- From
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
- Date
- Jun 17, 2015, 23:48 UTC
- Message-ID
- <989982277.592587.1434584914349.JavaMail.zimbra@ensimag.grenoble-inp.fr>
- In-Reply-To
- <xmqqioam58kz.fsf@gitster.dls.corp.google.com>
Show 5 quoted lines
> Junio C Hamano <gitster@pobox.com> writes > Suffix "rgx" that means "regular expression" is a bit unusual, and > also hard to read when squashed to another word. Elsewhere in the > same script, we seem to use $re_whatever to store precompiled > regular expressions, so perhaps $re_comment, $re_quote, etc.?
Yes it's indeed a better name. I had not seen it, thanks!
Show 8 quoted lines
> > + if ($str_address ne "" && $str_phrase ne "") {
> > + $str_address = qq[<$str_address>];
> > + }
>
> We see both "git@vger.kernel.org" and "<git@vger.kernel.org>" around
> here for an address without comment or phrase; this chooses to turn
> them both into "<git@vger.kernel.org>" form? Not a complaint but am
> thinking aloud to see if I am reading it correctly.If there's no phrase, this will choose the "git@vger.kernel.org" form, in both cases, because it'll be recognize as an address, $str_address will be "git@vger.kernel.org" and $str_phrase will be empty before the if ($str_address ne "" ...) Here are some tests:
Input: <jdoe@example.com> Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: jdoe@example.com Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: Jane <jdoe@example.com> Split: Jane <jdoe@example.com> M::A : Jane <jdoe@example.com> ---------- Input: Jane Doe <jdoe@example.com> Split: Jane Doe <jdoe@example.com> M::A : Jane Doe <jdoe@example.com> ---------- Input: "Jane" <jdoe@example.com> Split: "Jane" <jdoe@example.com> M::A : "Jane" <jdoe@example.com> ---------- Input: "Doe, Jane" <jdoe@example.com> Split: "Doe, Jane" <jdoe@example.com> M::A : "Doe, Jane" <jdoe@example.com>
I've some more tests, maybe I should put them all in this post ?