PDA

View Full Version : Domain name extension size


Spookster
05-29-2003, 04:07 AM
Just wondering if anybody knows for a fact if there are any domain name extensions that are longer than 3 characters. I'm setting up an email validation script and it currently checks for extension lengths of 2-3 characters so I just wanted to make sure I don't invalidate a valid address.

Thanks

mouse
05-29-2003, 04:19 AM
.info

.museum :eek:

Spookster
05-29-2003, 04:24 AM
Originally posted by mouse
.info

.museum :eek:

Thanks mouse.

I just discovered that probably about the same time you posted. :D

http://www.icann.org/tlds/

Don't know why I hadn't thought to go to ICANNs site for this. Not only can domain extensions be longer that 3, but they can get at least up to 6 characters in length. Possibly even longer judging by some TLD applications. One already in existence is .museum.

So much for validating the domain extension. :(

mouse
05-29-2003, 06:40 AM
Might it be more effective to verify against a list of possible extensions, rather than validate based on the number of characters. I mean .zz doesn't exist, but .zr does (I think) so a system without verification wouldn't be infallible, whereas a plain verification system would be...

Spookster
05-29-2003, 07:27 AM
Originally posted by mouse
Might it be more effective to verify against a list of possible extensions, rather than validate based on the number of characters. I mean .zz doesn't exist, but .zr does (I think) so a system without verification wouldn't be infallible, whereas a plain verification system would be...

I had considered that but then everytime a new ccTLD or a new gTLD comes out then it would have to be added to the list in the validation routine.

So it is sort of compromise of sorts. I can check the domain extension against all TLDs and make the validation very good but then I have to keep track of new TLDs and add them to the validation routine. Or I can simply check for the length of a domain extension which has to be at least 2 characters and currently as far as I can tell up to 6 characters. This allows bogus extensions to be inputted but I won't have to update the validation routine as much.

MotherNatrsSon
05-29-2003, 02:35 PM
This is how my checks.pl file validates email addresses. I don't know if it is what you are looking for but it might help.

sub check_email {
#print "Address keys=", @_, "<br>\n";
foreach $address (@_){
$address=$Form_Data->{"\$$address"};
next unless $address;
# print "Checking address.= $address<br>\n";
local ($name,$domain)=split/[\@|\%|\!]/,$address;
if ($name!~/^[\w\d<"][\w\d\,\.\%\-"<>\s]*$/){
push @errorlog,$address,"check_email";
push @errorlog,"First part of email address invalid";
next;
}
### break domain on '.' and check it for sanity
if ($domain eq ""){
push @errorlog,$address,"check_email";
push @errorlog,"No domain specified:$address";
last;
}
local(@d_regions)=split(/\./,$domain);
local ($region)=pop(@d_regions); # first check the last region
if ($region=~/^([a-zA-Z]{2,3})$/ || $region=~/^([0-9]{1,3}\]?)$/) {
next;
}else{
push @errorlog,$address,"check_email";
push @errorlog,"Domain part of email address:$domain invalid";
next;
}
$region=shift(@d_regions); #now check first region
if ($region=~/^(\[?[0-9]+)/ || $region=~/^([a-zA-Z0-9\-\#]+)$/) {
next;
}else{
push @errorlog,$address,"check_email";
push @errorlog,"Domain part of email address:$domain invalid";
next;
}
# now check everything else
foreach $region (@d_regions) {
if ($region!~/^([a-zA-Z0-9\-\#]+)$/) {
next;
}else{
push @errorlog,$address,"check_email";
push @errorlog,"Domain part of email address:$domain invalid";
next;
}
}

}
}

MNS