Identifiersflags: gi
UUID (v1–v5)
Match RFC 4122 UUIDs (versions 1–5) in the standard 8-4-4-4-12 hex format.
Try it in RegexProPattern
regexJavaScript
/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/giRaw source: [0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
How it works
The version nibble [1-5] and the variant bits [89ab] are constrained per RFC 4122. Matching is case-insensitive since UUIDs may be upper or lowercase.
Examples
Input
550e8400-e29b-41d4-a716-446655440000Matches
550e8400-e29b-41d4-a716-446655440000
Input
6ba7b810-9dad-11d1-80b4-00c04fd430c8Matches
6ba7b810-9dad-11d1-80b4-00c04fd430c8
Common use cases
- Database primary key validation
- API request ID extraction from logs
- Distributed system tracing
- Config file ID validation