Subject: | short domain label are reported invalid |
Date: | Mon, 27 Nov 2006 20:52:54 +0900 |
To: | bug-Email-Valid [...] rt.cpan.org |
From: | "Nobuaki ITO" <daydream.trippers [...] gmail.com> |
Dear Ricardo,
Since version 0.177, strict fqdn rule is applied to inspection of
email addresses.
Show quoted text
> 0.177 Sat Nov 25 2006
> resolve bug 22710: make fqdn rule more strict: domains must be multiple
> valid domain labels, and domain labels must be [a-z0-9][-a-z0-9]*
But regexp in subroutine '_is_domain_label' might not be correct.
Show quoted text> sub _is_domain_label {
> my ($self, $string) = @_;
> return unless $string =~ /\A
> [A-Z0-9] # must start with an alnum
> (?:
> [-A-Z0-9]+ # then maybe a dash or alnum
> [A-Z0-9] # finally ending with an alnum
> )* # lather, rinse, repeat
> \z/ix;
> return 1;
> }
With this regexp, domain labels which contain just two characters are
not matched. For example, the 'rt' part of 'rt.cpan.org' doesn't
conform the regexp.
Possible code:
sub _is_domain_label {
my ($self, $string) = @_;
return unless $string =~ /\A
[A-Z0-9] # must start with an alnum
(?:
[-A-Z0-9]* # then maybe a dash or alnum
[A-Z0-9] # finally ending with an alnum
)? # lather, rinse
\z/ix;
return 1;
}
Regards.
--
dayflower