We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5440442 + 402b351 commit 9bc7e82Copy full SHA for 9bc7e82
src/validators/mac_address.py
@@ -29,4 +29,8 @@ def mac_address(value: str, /):
29
(Literal[True]): If `value` is a valid MAC address.
30
(ValidationError): If `value` is an invalid MAC address.
31
"""
32
+ # Check for mixed separators: MAC addresses cannot use both ':' and '-' simultaneously
33
+ if ":" in value and "-" in value:
34
+ return False
35
+
36
return re.match(r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", value) if value else False
0 commit comments