regex for mac address
match ethernet mac address
^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}$
Regex Flags
global match
?
ignore case
?
multiline
?
dotAll
?
unicode
?
sticky
?
01:02:03:04:ab:cd
definitely:not:a:mac
01-02-03-04-ab-cd
A simple expression to match an ethernet MAC address
A media access control address is a unique identifier assigned to a network interface controller for use as a network address within a network.
The expression is a 6 byte hexadecimal which is separated by colon (:)
or a dash (-)
.
Cheatsheet
expr | usage |
---|---|
/[a-zA-Z0-9]/ | matches all lowercase, uppercase letters and numbers |
/(hello){4}/ | matches "hellohellohellohello" |
iHateRegex
by
geon