allow domain name label to start with a digit

This commit is contained in:
Juha Heinanen
2018-12-13 04:05:26 +02:00
parent 607cceb5b0
commit 7a0a6321f2

View File

@ -149,8 +149,8 @@ object Utils {
fun checkDomain(domain: String): Boolean {
val parts = domain.split(".")
for (p in parts) {
if ((p.length == 0) || p.endsWith("-") ||
!Regex("^[a-zA-z]([-a-zA-Z0-9])*\$").matches(p))
if (p.endsWith("-") || p.startsWith("-") ||
!Regex("^[-a-zA-Z0-9]+\$").matches(p))
return false
}
return true