Regular Expressions 101

Community Patterns

Mac Address

0

Regular Expression
PCRE (PHP <7.3)

/
([\da-f]{2}\-){5}([\da-f]{2})
/
gm

Description

Mac address is 6 parts of 2 hexadecimal digits separated by a special character "-" so, there are 5 parts of digits followed by the character "-" then, one part without that character.

Submitted by EMAM1999 - 3 years ago