REGEXVAULTv2.0
Web & Network/MAC Address
Verified Safe

EUI-64 (64-bit Extended Unique Identifier) Regex for PHP

/^[0-9a-fA-F]{2}(?:[:-][0-9a-fA-F]{2}){7}$/

What this pattern does

This page provides a well-structured, multi-part regular expression for matching eui-64 (64-bit extended unique identifier), ported and verified for PHP. A rigorously tested regex reduces debugging time and protects your application from edge-case failures. The snippet below is ready to drop into your PHP project — whether you're validating in a Laravel validator, a WordPress plugin, or a standalone PHP script.

Php Implementation

Php
<?php
// EUI-64 (64-bit Extended Unique Identifier)
// ReDoS-safe | RegexVault — Web & Network > MAC Address

define('EUI64_64BIT_EXTENDED_UNIQUE_IDENTIFIER_PATTERN', '/^[0-9a-fA-F]{2}(?:[:-][0-9a-fA-F]{2}){7}$/');

function validate_eui64_64bit_extended_unique_identifier(string $input): bool {
    return (bool) preg_match(EUI64_64BIT_EXTENDED_UNIQUE_IDENTIFIER_PATTERN, $input);
}

// Example
var_dump(validate_eui64_64bit_extended_unique_identifier("00:1a:2b:ff:fe:3c:4d:5e")); // bool(true)

Test Cases

Matches (Valid)
Rejects (Invalid)
00:1a:2b:ff:fe:3c:4d:5e00:1a:2b:3c:4d:5e
FF-FF-FF-FF-FF-FF-FF-FF00:1a:2b:ff:fe:3c:4d
02-50-56-ff-fe-a1-b2-c300:1a:2b:ff:fe:3c:4d:5e:6f
A0:B1:C2:D3:E4:F5:06:0700.1a.2b.ff.fe.3c.4d.5e
00:00:00:ff:fe:00:00:00GG:HH:II:JJ:KK:LL:MM:NN

When to use this pattern

This pattern is drawn from the Web & Network > MAC Address category and carries a ReDoS-safe certification. That matters for PHP developers because especially relevant in PHP where PCRE backtracking limits can trigger silent failures on malicious input. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.

Common Pitfalls

The separator must be consistent — do not mix colons and hyphens within a single address (though this pattern accepts either uniformly).

Technical Notes

EUI-64 is constructed from a MAC-48 by inserting ff:fe in the middle. The Universal/Local bit (bit 6 of octet 1) is flipped to form IPv6 Modified EUI-64 interface identifiers.

Have a pattern that belongs in the vault?

Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.

Submit a Pattern