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>
Horst H. von Brand committed
Jun 3, 2006 at 13:11 UTC
e96fd30553bb57a76ad38f703a3fea5b53c45ff9
1 file changed
+3
-6
git-send-email.perl
+3
-6
@@ -314,18 +314,15 @@ sub extract_valid_address {
314
my $address = shift;
315
316
# check for a local address:
317
- return $address if ($address =~ /^([\w\-]+)$/);
317
+ return $address if ($address =~ /^([\w\-.]+)$/);
318
319
if ($have_email_valid) {
320
return Email::Valid->address($address);
321
} else {
322
# less robust/correct than the monster regexp in Email::Valid,
323
# but still does a 99% job, and one less dependency
324
- my $cleaned_address;
325
- if ($address =~ /([^\"<>\s]+@[^<>\s]+)/) {
326
- $cleaned_address = $1;
327
- }
328
- return $cleaned_address;
324
+ $address =~ /([\w\-.]+@[\w\-.]+)/;
325
+ return $1;
326
}
327
}
328