Regular Expressions 101

Community Patterns

Multiple MAC Address Validation

0

Regular Expression
PCRE2 (PHP >=7.3)

/
([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}),{1,100}|([0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}),{1,100}
/
gm

Description

Used to validate the list of MAC addresses is formatted correctly. The list of MACs can use ":", "-", or "." as a separator:

Example with a "-" separator: 00-11-22-33-44-55

Example with a ":" separator: 00:11:22:33:44:55

Example with a "." separator: 0011.2233.4455

Submitted by Joel Jordan - 2 years ago