//g
  • 100% Free
  • No Sign-Up
  • No Credit Card
  • No Free Trial
  • No Pro Tier
  • No Watermarks

Nothing is uploaded. Just open it and start.

UUID Regex

A UUID (versions 1 to 8) in its usual 8-4-4-4-12 hex form, any case.

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

Piece by piece

  1. ^the start of the text
  2. [0-9a-f]{8}one of 0–9, a–f, repeated exactly 8 times, as many as possible
  3. -the character “-”
  4. [0-9a-f]{4}one of 0–9, a–f, repeated exactly 4 times, as many as possible
  5. -the character “-”
  6. [1-8]one of 1–8
  7. [0-9a-f]{3}one of 0–9, a–f, repeated exactly 3 times, as many as possible
  8. -the character “-”
  9. [89ab]one of “8”, “9”, “a”, “b”
  10. [0-9a-f]{3}one of 0–9, a–f, repeated exactly 3 times, as many as possible
  11. -the character “-”
  12. [0-9a-f]{12}one of 0–9, a–f, repeated exactly 12 times, as many as possible
  13. $the end of the text

Examples

TextResult
123e4567-e89b-42d3-a456-426614174000Matches
0190F5C4-7B2A-7C3D-8E4F-5A6B7C8D9E0FMatches
123e4567e89b42d3a456426614174000Doesn't match
123e4567-e89b-42d3-c456-426614174000Doesn't match
not-a-uuidDoesn't match
  • The all-zero "nil" UUID doesn't match, as its version digit is 0.

Other common patterns

Test any regular expression →

Frequently asked questions

How do I use this uuid regex in JavaScript?
Write it as /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i and call re.test(text). It is anchored with ^ and $, so it checks the whole text; remove them to find it inside longer text (and add the g flag to find every one). The Code view writes it out for Python, Go and PHP too.
Is it a complete validator?
No regex is the whole story. The all-zero "nil" UUID doesn't match, as its version digit is 0.
Can I try it on my own text?
Yes. The tester above already holds the examples; paste your own text over them and every match is highlighted as you type. Nothing is uploaded.

Spotted a bug or have a suggestion?

Found something broken, have an idea, or just want to say thanks about any of our tools? Every message reaches a real person.