Regex for MAC address

Matches a MAC hardware address with : or - separators.

^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$

Proof it works

4/4 sample tests passed · compiles: true

SampleShould matchResult
00:1A:2B:3C:4D:5E yes pass
00-1a-2b-3c-4d-5e yes pass
00:1A:2B no pass
GG:1A:2B:3C:4D:5E no pass

Try your own input

Related patterns