mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-16 12:38:17 -06:00
Change DNSValidator-Regex
This Change the Regex for DNSValidator to be valid as per RFC 1123. Originally, RFC 952 specified that hostname segments could not start with a digit. From: http://en.wikipedia.org/wiki/Hostname `` The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. ``
This commit is contained in:
parent
c24fb8df84
commit
eb9d3183b5
@ -2,7 +2,7 @@ from django.core.validators import RegexValidator
|
||||
|
||||
|
||||
DNSValidator = RegexValidator(
|
||||
regex='^[0-9A-Za-z.-]+$',
|
||||
regex='^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$',
|
||||
message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names',
|
||||
code='invalid'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user