The MAC address of a computer is a unique identifier assigned to network interfaces at the time of manufacturing. MAC addresses are 6 bytes or 48 bits in length and are written in the nn:nn:nn:nn:nn:nn format, where each n represents a hexadecimal digit. To match a MAC address, one can write the following regex:
However, it is much cleaner and more readable to write the regex as follows:
Note how short and readable this regex pattern has become when compared to the previous regex.