I'm writing a Regex to validate email. The only one thing confuse me is:
Is it possible to have single character for top level domain name? (e.g.: lockevn.c)
Background: I knew top level domain name can be from 2 characters to anything (.uk, .us to .canon, .museum). I read some documents but I can't figure out does it allow 1 character or not.
Only three of the 26 possible single-letter domains have ever been registered under the .com domain, all before 1992. The other 23 single-letter .com domain names were registered January 1, 1992 by Jon Postel, with the intention to avoid a single company commercially controlling a letter of the alphabet.
A domain with special characters is converted to "Punycode", which consists of ASCII characters that are supported by DNS. For example: The domain "bücher.nu" converted to Punycode is "xn--bcher-kva.nu". You can type both versions of the domain in your browser.
Visit https://www.iana.org/. The length of TLDs varies: General use TLDs may now be longer than two or three characters in length. In fact, TLDs can be anywhere from two to 63 characters long.
The shortest possible valid name in DNS is the name of the root zone, which consists of a single octet where all bits are zero. It is usually written out for humans as a . character or as an empty string.
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:
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 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With