Number in the Top-Level Domain

Number in the top-level domain?

Conceptually, there is nothing that disallows numbers in a TLD and in the future, who knows, perhaps there will be numeric TLDs.

There are no TLDs at the moment that do have numbers in them - the function probably does not test against a list of known TLDs (as it is subject to change), but lexically.

Is it possible to have one (single) character top level domain name?

It is technically possible, however, there are no single character tlds that have been accepted into the root (as of the moment) so the answer is:

Yes, it is possible to have single character for top level domain name, however, there are currently no single character TLDs in the root.

You can see the list of TLDs that are currently in the root at this URL:

  • http://data.iana.org/TLD/tlds-alpha-by-domain.txt

RFC-952 shows what a "name" is, this includes what is valid as a top level domain:

A "name" (Net, Host, Gateway, or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
sign (-), and period (.).

Additionally, the grammar from RFC-952 shows:

 <name>  ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]

RFC-1123 section 2.1 specifically allowed single letter domains & subdomains, changing the initial grammar of RFC-952 from starting with just a letter to being more relaxed, so now you are allowed to have single letter top level domains that are a number:

2.1  Host Names and Numbers

The syntax of a legal Internet host name was specified in RFC-952.
One aspect of host name syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit. Host software MUST support this more liberal
syntax.

EDIT: As per @mr.spuratic's comment, RFC-3696 section 2 tightened the rules for top level domains, stating:

     There is an additional rule that essentially requires
that top-level domain names not be all-numeric.

This means that:

  • a. is a valid top level domain
  • 1. is not a valid top level domain

A very unscientific test of this shows that if I add "a" into my hosts file pointing to my local machine, going to http://a in my address bar does show my Apache welcome page.

Does this regex allows number in top level domain?

The regex you've provided won't allow Numbers in top level domains.
[a-z]{2,6}$ is the part checking the top level domain. It'll only allow lower case characters, minimal 2 characters max 6 characters.

EDIT: Let's deconstrunct your your regex for clearity.
^[a-z0-9](\.?[a-z0-9_-]){0,}@[a-z0-9-]+\.([a-z]{1,6}\.)?[a-z]{2,6}$
the ^[a-z0-9](\.?[a-z0-9_-]){0,} part checks from the beginning of the string if there are only allowed characters that are a-zand 0-9 followed by an optional . followed by a-zand 0-9 aswell as _ and - zero to infinite times.

@[a-z0-9-]+\.([a-z]{1,6}\.)? checks for an @ after the first part aswell as validity of the domain, a-z and 0-9 including - followed by a . with an optional a-z2 to 6 times, up to one time i.E. google.com would be acceptable at this point but the .com part is optional.

[a-z]{2,6}$ checks for a-z 2 to 6 times and the end of the string indicated by $. meaning this is the part checking for the top level domain.

your regex would accept: blah@google.com aswell as blah@google.com.com

regex toplevel domain with/without numbers

The link you refer to is a little bit muddy. The (?=...) lookahead basically allows you to specify an additional constraint on the string you want to match, but in this particular case, you don't need more constraints than you already have.

([^.]+[.])*[^.]+[.][A-Za-z]{2}$

matches a domain (with optional subdomains) which contains a letters-only two-character ccTLD; and

([^.]+[.])*[^.]+[.][-A-Za-z0-9]{3,}$

matches a domain (with oiptional subdomains) which contains more than three characters, letters or numbers.

Combining the two, factoring out the optional subdomain to a non-capturing group, yields

(?:[^.]+[.])*([^.]+[.][A-Za-z]{2}|[^.]+[.][-A-Za-z0-9]{3,})$

which is still arguably wrong for actual top-level domains which have multiple labels (like co.uk or gob.mx) and doesn't allow for single-letter top-level domains; but it probably does what you are asking for.

Can a domain consist of only TLD (top level domain)?

Yes. Quick and dirty check:

$ for tld in $(wget -O- -q https://data.iana.org/TLD/tlds-alpha-by-domain.txt); do result=$(dig +short ${tld}. a); if [ -n "$result" ]; then echo "$tld $result"; fi; done

then, for example:
http://ai/

How to determine the number of domains of a specific country TLD?

the better search query would be: site:de

but even so, the result count of goolge is just a very very very blurry page estimate (a.k.a. completely wrong and not what you are looking for).

google is the wrong source for this.

but via google i found this
http://www.denic.de/hintergrund/geschichte-der-denic-eg.html

August 2009 13 Millionen Domains
unterhalb von .de registriert –
darunter 463.000 IDNs.



Related Topics



Leave a reply



Submit