UUID v4 Regex

Validate standard 128-bit universally unique identifiers (UUID v4) and GUID string formats.

//gi
Valid: 550e8400-e29b-41d4-a716-446655440000, 123e4567-e89b-12d3-a456-426614174000 Invalid: 12345, not-a-uuid

Regex Cheatsheet

COMMON PATTERNS
SYNTAX REFERENCE
TOOLS FOR WRITING BETTER CODE
JetBrains All Products Pack
IDEs with built-in regex debugging, refactoring, and inspections.
Try free โ†’
Regex course on Udemy
Go from this cheatsheet to writing complex patterns confidently.
View course โ†’
DigitalOcean / hosting credit
Deploy the scripts you are testing patterns for.
Get credit โ†’
Affiliate disclosure: links above may earn us a commission โ€” this never affects the calculation results above.

Common Use Cases for UUID v4 Regex

Database Primary Keys

Validate API route URL parameters containing record UUIDs.

Frequently Asked Questions

What is the structure of a UUID v4?

UUID v4 consists of 5 hex groups (8-4-4-4-12) where the 13th character is "4" and the 17th character is 8, 9, a, or b.