Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(?:[[: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 - 8 years ago