是否可以有一个(单个)字符的顶级域名? [英] Is it possible to have one (single) character top level domain name?

查看:307
本文介绍了是否可以有一个(单个)字符的顶级域名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个正则表达式来验证电子邮件。唯一的一件事是让我感到困惑的是:

I'm writing a Regex to validate email. The only one thing confuse me is:

是否可以为顶级域名使用单一字符?(例如: lockevn .c

Is it possible to have single character for top level domain name? (e.g.: lockevn.c)

背景:我知道顶级域名可以从2个字符到任何(.uk,.us到。canon ,.museum)。我读了一些文件,但我无法确定它是否允许1个字符。

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.

推荐答案

然而,技术上是可能的,没有单个字符的tld被接受到根目录(因为那一刻),所以答案是:

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:

,它 可能有顶级域名的单一字符 ,根目前只有单字符TLD。

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

您可以看到目前位于该网址根目录中的TLD列表:

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显示什么是名称,这包括什么是有效的顶级域名:

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 (.).

此外,RFC-952的语法显示:

Additionally, the grammar from RFC-952 shows:

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

RFC-1123第2.1节专门允许单字母域和子域名,将RFC-952的初始语法从刚从一封信变为更轻松,因此现在您可以获得一个单字母顶级域名:

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.






编辑: per @ mr.spuratic的评论,RFC-3696第2节收紧了顶级域名的规则,说:


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。 是一个有效的顶级域名

  • strong> 1。 不是有效的顶级域名

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

一个非常不科学的测试这表明如果我将 a 添加到指向我本地机器的主机文件中,则转到 http:// a 在我的地址栏中显示我的Apache欢迎页面。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆