MAC Address Regular Expression

A regular expression to parse and validate MAC (media access control address) address.

/^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i

What Is MAC Address:

A media access control address (MAC address) is a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment. This use is common in most IEEE 802 networking technologies, including Ethernet, Wi-Fi, and Bluetooth. See The Mac Address of Your Device for more details.

MAC Address Examples:

  • 38:f9:d3:4b:f5:51
  • 00-0C-29-CA-E4-66

See Also:

Regex Is Copied!