我正在编写一个Regex来验证电子邮件.唯一令我困惑的是:
顶级域名是否可以使用单个字符?(例如:lockevn.c)
背景:我知道顶级域名可以是2个字符到任何东西(.uk,.us到.canon,.museum).我读了一些文件,但我无法弄清楚它是否允许1个字符.
Tim*_*eld 67
从技术上来说,没有单个字符tld被接受到根目录(截至目前),所以答案是:
是的,这是可能有单个字符的顶级域名,但是,目前有没有在根单字符顶级域名.
您可以在此URL中查看当前位于根目录中的TLD列表:
RFC-952显示了"名称"的含义,其中包括有效的顶级域名:
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 (.).
Run Code Online (Sandbox Code Playgroud)
此外,RFC-952的语法显示:
<name> ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]
Run Code Online (Sandbox Code Playgroud)
RFC-1123第2.1节特别允许使用单字母域和子域,将RFC-952的初始语法从仅从字母开始更改为更轻松,因此现在您可以使用单字母顶级域名作为数字:
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.
Run Code Online (Sandbox Code Playgroud)
编辑:根据@ mr.spuratic的评论,RFC-3696第2节收紧了顶级域名的规则,声明:
There is an additional rule that essentially requires
that top-level domain names not be all-numeric.
Run Code Online (Sandbox Code Playgroud)
这意味着:
对此的一个非常不科学的测试表明,如果我在指向我的本地机器的文件中添加" a
" hosts
,那么转到http://a
我的地址栏会显示我的Apache欢迎页面.
归档时间: |
|
查看次数: |
20693 次 |
最近记录: |