From 6271cc9af02fbab12336f7e936a029c5d1399623 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Thu, 19 Dec 2024 10:18:58 -0600 Subject: [PATCH] fix the regex to help with form tests --- django/core/validators.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/django/core/validators.py b/django/core/validators.py index 01c6dbf82e..b183feb402 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -217,13 +217,14 @@ class EmailValidator: r'*"\Z)', re.IGNORECASE, ) - # Use DomainNameValidator patterns but remove the optional trailing dot domain_regex = _lazy_re_compile( - r"^" + DomainNameValidator.hostname_re + DomainNameValidator.domain_re + r"\." - r"(?!-)" - r"(?:[a-z" + DomainNameValidator.ul + "-]{2,63}|xn--[a-z0-9]{1,59})" - r"(?