Regular Expressions 101

MAC Address

Open Workspace
  • JavaScript
  • Match
0

Regular Expression

/
^(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\1){4}[[:xdigit:]]{2}$
/

Description

Validates upper and lower case, allows all : or all -.

Obtained here:

http://stackoverflow.com/questions/4260467/what-is-a-regular-expression-for-a-mac-address

From Pilcrow

Submitted by Pilcrow - http://stackoverflow.com/questions/4260467/what-is-a-regular-expression-for-a-mac-address