What is the correct regular expression for matching MAC addresses ? I googled about that but, most of questions and answers are incomplete. They only provide a regular expre
MAC addresses can be 6 or 20 bytes (infiniband)
The correct regexp assuming the separator is : is
^([0-9A-Fa-f]{2}:){5}(([0-9A-Fa-f]{2}:){14})?([0-9A-Fa-f]{2})$
We match 5 times XX: optionally we match another 14 times XX: and we match XX