100% Client-Side β’ 0 B Data Leaves Browser
formatting
Hardware MAC Address Regex
Matches standard 48-bit physical MAC addresses formatted with colons or hyphens.
Regular Expression Pattern:
/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/
Valid Match Example:
00:1A:2B:3C:4D:5E
Invalid / Non-Match Example:
00:1A:2B:3C:4D
Regex Syntax Breakdown & Explanation
- β’([0-9A-Fa-f]{2}[:-]){5} : First five pairs of hex digits followed by colon or dash
- β’([0-9A-Fa-f]{2}) : Final hex octet pair
Implementation in Popular Languages
JavaScript / TypeScript
const regex = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
const isValid = regex.test("00:1A:2B:3C:4D:5E");
console.log(isValid); // truePython (re)
import re
pattern = r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"
match = re.match(pattern, "00:1A:2B:3C:4D:5E")
print(bool(match)) # TrueGo (regexp)
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`)
fmt.Println(re.MatchString("00:1A:2B:3C:4D:5E"))
}Frequently Asked Questions
Frequently Asked Questions
Everything you need to know regarding specifications, syntax, and security best practices.
The regular expression pattern is /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/. Matches standard 48-bit physical MAC addresses formatted with colons or hyphens.