{"thread":{"id":"4380","subject":"[PATCH] Cleanup git-send-email.perl:extract_valid_email","startedAt":"2006-06-03T17:11:48Z","lastAt":"2006-06-03T22:49:36Z","messageCount":2,"participants":["Horst H. von Brand","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"21142","messageId":"11493547080-git-send-email-vonbrand@inf.utfsm.cl","threadId":"4380","inReplyTo":null,"subject":"[PATCH] Cleanup git-send-email.perl:extract_valid_email","fromName":"Horst H. von Brand","fromEmail":"vonbrand@inf.utfsm.cl","sentAt":"2006-06-03T17:11:48Z","receivedAt":"2006-06-03T17:11:48Z","isPatch":true,"sender":{"key":"vonbrand@inf.utfsm.cl","avatar":"https://avatars.githubusercontent.com/u/211384?v=4"},"body":"- Fix the regular expressions for local addresses\n- Fix the fallback regexp for non-local addresses, simplify the logic\n\nSigned-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>\n---\n git-send-email.perl |    9 +++------\n 1 files changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex ed1d89b..a7a7797 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -314,18 +314,15 @@ sub extract_valid_address {\n \tmy $address = shift;\n \n \t# check for a local address:\n-\treturn $address if ($address =~ /^([\\w\\-]+)$/);\n+\treturn $address if ($address =~ /^([\\w\\-.]+)$/);\n \n \tif ($have_email_valid) {\n \t\treturn Email::Valid->address($address);\n \t} else {\n \t\t# less robust/correct than the monster regexp in Email::Valid,\n \t\t# but still does a 99% job, and one less dependency\n-\t\tmy $cleaned_address;\n-\t\tif ($address =~ /([^\\\"<>\\s]+@[^<>\\s]+)/) {\n-\t\t\t$cleaned_address = $1;\n-\t\t}\n-\t\treturn $cleaned_address;\n+\t\t$address =~ /([\\w\\-.]+@[\\w\\-.]+)/;\n+\t\treturn $1;\n \t}\n }\n \n-- \n1.3.3.g86f7\n"},{"id":"21171","messageId":"20060603224935.GA10324@hand.yhbt.net","threadId":"4380","inReplyTo":"11493547080-git-send-email-vonbrand@inf.utfsm.cl","subject":"Re: [PATCH] Cleanup git-send-email.perl:extract_valid_email","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-06-03T22:49:36Z","receivedAt":"2006-06-03T22:49:36Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Horst H. von Brand\" <vonbrand@inf.utfsm.cl> wrote:\n> - Fix the regular expressions for local addresses\n> - Fix the fallback regexp for non-local addresses, simplify the logic\n> \n> Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>\n> ---\n>  git-send-email.perl |    9 +++------\n>  1 files changed, 3 insertions(+), 6 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index ed1d89b..a7a7797 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -314,18 +314,15 @@ sub extract_valid_address {\n>  \tmy $address = shift;\n>  \n>  \t# check for a local address:\n> -\treturn $address if ($address =~ /^([\\w\\-]+)$/);\n> +\treturn $address if ($address =~ /^([\\w\\-.]+)$/);\n\nI keep forgetting this, '+' is a valid (and useful) setup, too.\n\n>  \n>  \tif ($have_email_valid) {\n>  \t\treturn Email::Valid->address($address);\n>  \t} else {\n>  \t\t# less robust/correct than the monster regexp in Email::Valid,\n>  \t\t# but still does a 99% job, and one less dependency\n> -\t\tmy $cleaned_address;\n> -\t\tif ($address =~ /([^\\\"<>\\s]+@[^<>\\s]+)/) {\n> -\t\t\t$cleaned_address = $1;\n> -\t\t}\n> -\t\treturn $cleaned_address;\n> +\t\t$address =~ /([\\w\\-.]+@[\\w\\-.]+)/;\n> +\t\treturn $1;\n\nActually, I'm retracting my earlier ack on this.  This is way too\nrestrictive.  I'd rather allow an occasional invalid email address than\nto reject valid ones.  I generally trust git users to know what they're\ndoing when entering email addresses[1].\n\n*, $, ^, +, = are all valid characters in the username portion (not sure\nabout local accounts, though), and I'm sure there are more that I don't\nknow about.\n\n[1] - of course, without address book support in git-send-email, I think\nI would've left the 'k' out of Junio's email address by now.  Of course\nthere's also the issue of where I work and having several people using\nvariations of rob/robert in their email address.  I'm likely to make\nerrors like these far more than entering addresses that email systems\nconsider invalid, and I suspect I'm not the only one.\n\n-- \nEric Wong\n"}]}