A "valid" MAC address is 6 groups of hexadecimal character pairs, separated by a dash or colon.
Example:
3D-F2-C9-A6-B3-4F
08:F2:C9:A6:B3:4F
However, "invalid" MAC addresses contain hex pairs that are 00
, FF
, 88
or 87
.
Example:
00-00-00-00-00-00
FF-FF-FF-FF-FF-FF
88-88-88-88-87-88
This is what I got so far:
(?!8)([0-9A-F]{2})([:-][0-9A-F]{2}){5}
But for some reason I don't know why, I cannot use:
(?!88|87|FF|00)
For the negated portion of the regex.
NOTE: Not a duplicate SO entry because this looks for invalid hex pairs and excludes them.