From: Remi Lespinet Date: Wed, 17 Jun 2015 23:48:34 GMT Subject: [PATCH/RFC v4 07/10] send-email: reduce dependancies impact on parse_address_line Message-ID: <989982277.592587.1434584914349.JavaMail.zimbra@ensimag.grenoble-inp.fr> In-Reply-To: > Junio C Hamano 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! > > + if ($str_address ne "" && $str_phrase ne "") { > > + $str_address = qq[<$str_address>]; > > + } > > We see both "git@vger.kernel.org" and "" around > here for an address without comment or phrase; this chooses to turn > them both into "" 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: Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: jdoe@example.com Split: jdoe@example.com M::A : jdoe@example.com ---------- Input: Jane Split: Jane M::A : Jane ---------- Input: Jane Doe Split: Jane Doe M::A : Jane Doe ---------- Input: "Jane" Split: "Jane" M::A : "Jane" ---------- Input: "Doe, Jane" Split: "Doe, Jane" M::A : "Doe, Jane" I've some more tests, maybe I should put them all in this post ?