Skip to content

Commit

Permalink
Cleanup git-send-email.perl:extract_valid_email
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Horst H. von Brand authored and Junio C Hamano committed Jun 4, 2006
1 parent 16a4c6e commit e96fd30
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit e96fd30

Please sign in to comment.