Merge pull request #40 from teohz/regex_fix

Expand domain length from 6 to 18 characters
This commit is contained in:
Eduardo Silva 2024-09-03 16:44:03 -03:00 committed by GitHub
commit ddf96a2e52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,7 +11,7 @@ def is_valid_ip_or_hostname(value):
pass
# Regex to check valid hostname (RFC 1123)
hostname_regex = r'^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.)+[A-Za-z]{2,6}$'
hostname_regex = r'^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.)+[A-Za-z]{2,18}$'
if re.match(hostname_regex, value):
return True
@ -33,4 +33,4 @@ def list_network_interfaces():
interface_name = parts[1].split('@')[0] # Remove qualquer coisa após '@'
interfaces.append(interface_name)
return interfaces
return interfaces