REGEXVAULTv2.0
Web & Network/MAC Address
Verified Safe

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

/^[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 JavaScript. A rigorously tested regex reduces debugging time and protects your application from edge-case failures. The snippet below is ready to drop into your JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.

Javascript Implementation

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

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

function validateEui6464bitExtendedUniqueIdentifier(input: string): boolean {
  return eui6464bitExtendedUniqueIdentifierRegex.test(input);
}

// Example
console.log(validateEui6464bitExtendedUniqueIdentifier("00:1a:2b:ff:fe:3c:4d:5e")); // 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 JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. 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