是否可以拥有一个(单个)字符的顶级域名? [英] Is it possible to have one (single) character top level domain name?
问题描述
我正在编写一个正则表达式来验证电子邮件.唯一让我困惑的是:
顶级域名可以有单个字符吗?(例如:lockevn.c)
背景:我知道顶级域名可以是 2 个字符到任何字符(.uk、.us 到 .canon、.museum).我阅读了一些文档,但我不知道它是否允许 1 个字符.
这在技术上是可行的,但是,根目录中还没有接受单个字符的 tld(截至目前),因此答案是:>
是的,顶级域名可以使用单个字符,但是,目前没有strong> 根中的单字符 TLD.
您可以在此 URL 处查看当前位于根目录中的 TLD 列表:
RFC-952 显示了名称"是什么,这包括作为顶级域有效的内容:
名称"(网络、主机、网关或域名)是一个文本字符串从字母表 (A-Z)、数字 (0-9)、减号中提取到 24 个字符符号 (-) 和句点 (.).
此外,来自 RFC-952 的语法显示:
<名称>::= [*[]]
RFC-1123 第 2.1 节明确允许单字母域 &子域,将 RFC-952 的初始语法从仅以字母开头更改为更加宽松,因此现在您可以拥有由数字组成的单字母顶级域:
2.1 主机名和号码RFC-952 中指定了合法 Internet 主机名的语法.主机名语法的一方面在此更改:放宽对第一个字符的限制以允许字母或数字.主机软件必须支持这种更自由的句法.
<小时>
根据@mr.spuratic 的评论,RFC-3696 第 2 节收紧了顶级域的规则,声明:
有一个额外的规则,本质上需要顶级域名不是全数字的.
<小时>
这意味着:
- a. 是有效的顶级域
- 1. 不是有效的顶级域
对此的一个非常不科学的测试表明,如果我将a
"添加到我的 hosts
文件中,指向我的本地机器,则转到 http://地址栏中的
确实显示了我的 Apache 欢迎页面.
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.
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. 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.
这篇关于是否可以拥有一个(单个)字符的顶级域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!