REGEXVAULTv2.0
Web & Network/Misc
Verified Safe

UUID v1 Regex for JavaScript

/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i

What this pattern does

This page provides a well-structured, multi-part regular expression for matching uuid v1, 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
// UUID v1
// ReDoS-safe | RegexVault — Web & Network > Misc

const uuidV1Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

function validateUuidV1(input: string): boolean {
  return uuidV1Regex.test(input);
}

// Example
console.log(validateUuidV1("a8098c1a-f86e-11da-bd1a-00112444be1e")); // true

Test Cases

Matches (Valid)
Rejects (Invalid)
a8098c1a-f86e-11da-bd1a-00112444be1ea8098c1a-f86e-21da-bd1a-00112444be1e
6ba7b810-9dad-11d1-80b4-00c04fd430c8a8098c1a-f86e-11da-c01a-00112444be1e
00000000-0000-1000-8000-000000000000not-a-uuid
ffffffff-ffff-1fff-bfff-ffffffffffffa8098c1af86e11dabd1a00112444be1e

When to use this pattern

This pattern is drawn from the Web & Network > Misc 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 time component in UUID v1 encodes a 60-bit timestamp with 100-nanosecond precision — it can be decoded to determine when and potentially where an ID was generated.

Technical Notes

UUID v1 embeds the MAC address of the generating machine in the node field (last 12 hex chars) — a privacy concern. UUID v4 is preferred for security-sensitive 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