diff --git a/src/validators/email.py b/src/validators/email.py index f1fb3f6f..5b57395c 100644 --- a/src/validators/email.py +++ b/src/validators/email.py @@ -85,7 +85,7 @@ def email( ) if re.match( # dot-atom - r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" + r"(^[-!#$%&'*+/=?^_`{}|~0-9a-z]+(\.[-!#$%&'*+/=?^_`{}|~0-9a-z]+)*$" # quoted-string + r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', username_part, diff --git a/src/validators/hostname.py b/src/validators/hostname.py index dd7e6991..55b30647 100644 --- a/src/validators/hostname.py +++ b/src/validators/hostname.py @@ -25,7 +25,7 @@ def _simple_hostname_regex(): """Simple hostname validation regex.""" # {0,59} because two characters are already matched at # the beginning and at the end, making the range {1, 61} - return re.compile(r"^(?!-)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,59}[a-zA-Z0-9])?(?