Skip to main content
Regexflux

UUID v4

intermediate

Matches UUID version 4 strings in standard hyphenated format.

uuididentifieruniquevalidation

Pattern

/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi

Try It

0 of 5 strings matched

Explanation

Matches UUID v4: 8-4-4-4-12 hex digit groups separated by hyphens. The version nibble (position 13) must be 4, and the variant nibble (position 17) must be 8, 9, a, or b.

Test Strings

Matching

  • 550e8400-e29b-41d4-a716-446655440000
  • 6ba7b810-9dad-41d1-80b4-00c04fd430c8

Non-matching

  • 550e8400-e29b-31d4-a716-446655440000
  • not-a-uuid
  • 550e8400e29b41d4a716446655440000

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Common Variations

Any version

[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Matches any UUID version

Related Patterns