Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

域名类的正则表达式 #6

Open
JCHappytime opened this issue Mar 27, 2021 · 0 comments
Open

域名类的正则表达式 #6

JCHappytime opened this issue Mar 27, 2021 · 0 comments

Comments

@JCHappytime
Copy link
Owner

JCHappytime commented Mar 27, 2021

域名

DNS规定,域名中的标号都由英文歌数字组成,每一个标号不超过63个字符(为了方便记忆,一般也不会超过12个字符),也不区分大小写字母。标号中除了连字符(-)外不能使用其他的标点符号。

reg=/^(?=^.{3,255}$)[a-z0-9][-a-z0-9]{0,62}(\.[a-z0-9][-a-z0-9]{0,62})+$/

reg.test('baidu.com');   // =>true
reg.test('baidu中国.com');   // =>false
@JCHappytime JCHappytime changed the title 其他类的正则表达式 域名类的正则表达式 Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant