git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Horst von Brand <vonbrand@inf.utfsm.cl>
To: Junio C Hamano <junkio@cox.net>
Cc: Horst von Brand <vonbrand@inf.utfsm.cl>, git@vger.kernel.org
Subject: Re: [PATCH] Cleanup git-send-email.perl:extract_valid_email
Date: Tue, 06 Jun 2006 12:05:42 -0400	[thread overview]
Message-ID: <200606061605.k56G5gHo006581@laptop11.inf.utfsm.cl> (raw)
In-Reply-To: Message from Junio C Hamano <junkio@cox.net>  of "Tue, 06 Jun 2006 08:54:17 MST." <7vpshmth3q.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Horst von Brand <vonbrand@inf.utfsm.cl> writes:
> 
> >> diff --git a/git-send-email.perl b/git-send-email.perl
> >> index a7a7797..700d0c3 100755
> >> --- a/git-send-email.perl
> >> +++ b/git-send-email.perl
> >> @@ -312,16 +312,18 @@ our ($message_id, $cc, %mail, $subject, 
> >>  
> >>  sub extract_valid_address {
> >>  	my $address = shift;
> >> +	my $local_part_regexp = '[^<>"\s@]+';
> >> +	my $domain_regexp = '[^.<>"\s@]+\.[^<>"\s@]+';
> >
> > This forces a '.' in the domain, while vonbrand@localhost is perfectly
> > reasonable. Plus it doesn't disallow adyacent '.'s. What about:
> >
> >         my $domain_regexp = '[^.<>"\s@]+(\.[^<>"\s@]+)*';
> >
> > (but this is probably nitpicking...)
> 
> I do not have preference either way about allowing an address
> like tld-administrator@net myself, but Email::Valid->address
> does not seem to allow it, and I just copied that behaviour for
> consistency between two alternative implementations.

Reasonable.

> I think you meant to say:
> 
> >         my $domain_regexp = '[^.<>"\s@]+(\.[^.<>"\s@]+)*';
> 
> (i.e. exclude dot from the latter character class),

Right, my bad.

>                                                     but I am
> inclined to do this instead:
> 
> 	my $domain_regexp = '[^.<>"\s@]+(?:\.[^.<>"\s@]+)+';
> 
> (i.e. still require at least two levels).

OK, but be careful as this (?:...) is an extended regexp (needs /x on
match). I'd just leave it plain (the performance impact shouldn't be
noticeable). I don't see any use except for $1, so the extra parenthesis
should be safe.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

  reply	other threads:[~2006-06-06 16:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-03 17:11 [PATCH] Cleanup git-send-email.perl:extract_valid_email Horst H. von Brand
2006-06-03 22:49 ` Eric Wong
2006-06-04  0:10   ` Horst von Brand
2006-06-06  6:59     ` Junio C Hamano
2006-06-06 15:42       ` Horst von Brand
2006-06-06 15:54         ` Junio C Hamano
2006-06-06 16:05           ` Horst von Brand [this message]
2006-06-06 16:58             ` Junio C Hamano
2006-06-06 21:24               ` Horst von Brand
2006-06-06 21:39                 ` Junio C Hamano
2006-06-06 22:48                   ` Horst von Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200606061605.k56G5gHo006581@laptop11.inf.utfsm.cl \
    --to=vonbrand@inf.utfsm.cl \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).