Networkingflags: g

MAC Address

Match 48-bit MAC addresses written with colon or hyphen separators (e.g. 00:1A:2B:3C:4D:5E).

Try it in RegexPro

Pattern

regexJavaScript
/(?:[0-9A-Fa-f]{2}[:\-]){5}[0-9A-Fa-f]{2}/g

Raw source: (?:[0-9A-Fa-f]{2}[:\-]){5}[0-9A-Fa-f]{2}

How it works

Five pairs of hex digits each followed by : or -, then a final hex pair. Case-insensitive by character class to handle both upper and lower hex digits.

Examples

Input

00:1A:2B:3C:4D:5E

Matches

  • 00:1A:2B:3C:4D:5E

Input

AA-BB-CC-DD-EE-FF

Matches

  • AA-BB-CC-DD-EE-FF

Input

not a mac

No match

Common use cases

  • DHCP lease log parsing
  • Device inventory scans
  • Wi-Fi access control configuration
  • Network security monitoring