зеркало из https://github.com/microsoft/git.git
Cleanup git-send-email.perl:extract_valid_email
- Fix the regular expressions for local addresses - Fix the fallback regexp for non-local addresses, simplify the logic Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
16a4c6ee0d
Коммит
e96fd30553
|
@ -314,18 +314,15 @@ sub extract_valid_address {
|
|||
my $address = shift;
|
||||
|
||||
# check for a local address:
|
||||
return $address if ($address =~ /^([\w\-]+)$/);
|
||||
return $address if ($address =~ /^([\w\-.]+)$/);
|
||||
|
||||
if ($have_email_valid) {
|
||||
return Email::Valid->address($address);
|
||||
} else {
|
||||
# less robust/correct than the monster regexp in Email::Valid,
|
||||
# but still does a 99% job, and one less dependency
|
||||
my $cleaned_address;
|
||||
if ($address =~ /([^\"<>\s]+@[^<>\s]+)/) {
|
||||
$cleaned_address = $1;
|
||||
}
|
||||
return $cleaned_address;
|
||||
$address =~ /([\w\-.]+@[\w\-.]+)/;
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче