Cleanup git-send-email.perl:extract_valid_email
authorHorst H. von Brand <vonbrand@inf.utfsm.cl>
Sat, 3 Jun 2006 17:11:48 +0000 (13:11 -0400)
committerJunio C Hamano <junkio@cox.net>
Sun, 4 Jun 2006 07:00:20 +0000 (00:00 -0700)
- 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>
git-send-email.perl

index ed1d89b..a7a7797 100755 (executable)
@@ -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;
        }
 }