mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 08:11:49 +08:00
域名后缀只能为字母
This commit is contained in:
@@ -182,10 +182,6 @@ func CheckDomainNames(domains string) error {
|
||||
}
|
||||
|
||||
func ValidateDomainName(domain string) bool {
|
||||
pos := strings.LastIndex(domain, ".")
|
||||
if pos != -1 && len(domain[pos+1:]) < 2 {
|
||||
return false
|
||||
}
|
||||
RegExp := regexp.MustCompile(`^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$`)
|
||||
RegExp := regexp.MustCompile(`^([a-zA-Z0-9][-a-zA-Z0-9]{0,62}\.)+[A-Za-z]{2,18}$`)
|
||||
return RegExp.MatchString(domain)
|
||||
}
|
||||
|
Reference in New Issue
Block a user