fix: regex ignore-case uses only `a-z` by nandgator · Pull Request #349 · python-validators/validators · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/validators/email.py
2 changes: 1 addition & 1 deletion src/validators/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])?(?<!-)$")
return re.compile(r"^(?!-)[a-z0-9](?:[a-z0-9-]{0,59}[a-z0-9])?(?<!-)$", re.IGNORECASE)


def _port_validator(value: str):
Expand Down
2 changes: 1 addition & 1 deletion src/validators/iban.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def iban(value: str, /):
(ValidationError): If `value` is an invalid IBAN code.
"""
return (
(re.match(r"^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$", value) and _mod_check(value))
(re.match(r"^[a-z]{2}[0-9]{2}[a-z0-9]{11,30}$", value, re.IGNORECASE) and _mod_check(value))
if value
else False
)
8 changes: 5 additions & 3 deletions src/validators/url.py