Regex for UUID (v4-ish)

Matches an RFC-4122 UUID string.

^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$

Proof it works

3/3 sample tests passed · compiles: true

SampleShould matchResult
123e4567-e89b-12d3-a456-426614174000 yes pass
123e4567e89b12d3a456426614174000 no pass
not-a-uuid no pass

Try your own input

Related patterns