X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FAddress.pm;h=46aa0da7f9db085a1adb1f13b83b0b74455cd14d;hb=9bd675d33ad1e49bd2ebe12a1d216216e61380de;hp=cd5fbfbe3c4289e3028dc0b823a54c3121dfb672;hpb=13eda978e8937065575623d045f78592cbb6d022;p=public-inbox.git diff --git a/lib/PublicInbox/Address.pm b/lib/PublicInbox/Address.pm index cd5fbfbe..46aa0da7 100644 --- a/lib/PublicInbox/Address.pm +++ b/lib/PublicInbox/Address.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2016 all contributors +# Copyright (C) 2016-2019 all contributors # License: AGPL-3.0+ package PublicInbox::Address; use strict; @@ -7,7 +7,10 @@ use warnings; # very loose regexes, here. We don't need RFC-compliance, # just enough to make thing sanely displayable and pass to git -sub emails { ($_[0] =~ /([\w\.\+=\-]+\@[\w\.\-]+)>?\s*(?:,\s*|\z)/g) } +sub emails { + ($_[0] =~ /([\w\.\+=\?"\(\)\-!#\$%&'\*\/\^\`\|\{\}~]+\@[\w\.\-\(\)]+) + (?:\s[^>]*)?>?\s*(?:\(.*?\))?(?:,\s*|\z)/gx) +} sub names { map { @@ -16,8 +19,10 @@ sub names { my $e = $1; s/\A['"\s]*//; s/['"\s]*\z//; - $_ =~ /\S/ ? $_ : $e; - } split(/\@+[\w\.\-]+>?\s*(?:,\s*|\z)/, $_[0]); + $e = $_ =~ /\S/ ? $_ : $e; + $e =~ s/\@\S+\z//; + $e; + } split(/\@+[\w\.\-]+>?\s*(?:\(.*?\))?(?:,\s*|\z)/, $_[0]); } 1;