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:
Horst H. von Brand 2006-06-03 13:11:48 -04:00 коммит произвёл Junio C Hamano
Родитель 16a4c6ee0d
Коммит e96fd30553
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -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;
}
}