Need to validate MAC addresses in Go? The Qodex MAC Address Regex Go Validator helps ensure your patterns match standard formats like 01:23:45:67:89:AB. Ideal for networking, device authentication, and input validation.
Pair it with the IP Regex Go Validator, UUID Generator, or API Key Generator for secure test setups. Add Username, Email, or Phone Number Generators to complete mock profiles with ease.
[A-Z]
: uppercase letters[a-z]
: lowercase letters[0-9]
: digits\.
: a literal dot+
: one or more of the preceding*
: zero or more of the preceding?
: optional (zero or one)^
: start of string$
: end of string
Test your APIs today!
Write in plain English — Qodex turns it into secure, ready-to-run tests.
Regular Expression - Documentation
MAC Address Regex Go Validator
A MAC address (Media Access Control address) is a unique identifier used to label devices on a network. Validating these addresses is critical in systems that track, authorize, or communicate with hardware components. The Qodex MAC Address Regex Go Validator helps developers and testers quickly confirm whether a string follows valid MAC formatting using Go’s regexp package.
What is a MAC Address Regex?
In Go, you can use regular expressions to match MAC address patterns. A typical MAC address looks like this:
MAC addresses are composed of six groups of two hexadecimal digits separated by either colons or hyphens. The regex must ensure this format without allowing extra characters or missing segments.
Regex Pattern for MAC Addresses
Here’s the recommended Go regex for matching standard MAC addresses:
What it means:
^ – Start of string
([0-9a-fA-F]{2}[:-]){5} – Five pairs of hex digits followed by : or -
[0-9a-fA-F]{2} – Final pair without a separator
$ – End of string
This ensures the string is exactly 6 pairs and uses consistent separators.
How It Works
Input or paste your regex (or use the default).
Enter a test MAC address.
Instantly see whether it matches or fails.
Adjust your pattern as needed and validate again.
Example: Basic Validator
Use the Go Regex Tester to experiment with variations.
When Should You Use MAC Regex Validation?
Device registration systems: Validate MAC IDs during onboarding.
Network tools: Ensure clean, usable MAC input before connection setup.
IoT and embedded systems: Identify devices with consistency across logs.
Security software: Whitelist MACs using regex-based filtering.
Pro Tips for Better MAC Regex Validation
Use [0-9a-fA-F] to cover both upper and lowercase.
Stick to one separator style (colon or hyphen) within a regex to keep patterns strict.
Avoid patterns that allow trailing characters or incorrect segment lengths.
If comparing multiple device attributes, try pairing it with the IP Address Generator or UUID Generator.
Useful Metacharacters for MAC Regex
^
: Start of string$
: End of string[0-9a-fA-F]
: Any hex digit (case-insensitive){2}
: Exactly two characters[:-]
: Colon or hyphen separator{5}
: Repeat 5 times
You can copy this pattern directly into the Go Regex Tester to test your logic live.
Combine with These Tools
IP Address Generator – Simulate IP + MAC configurations
Username Generator – Pair MACs with user IDs in device dashboards
Password Generator – Secure MAC-tied device access
Phone Number Generator – Add mobile metadata to device records
Go Regex Tester – Debug any complex Go regex pattern quickly