Regex for UUIDs

Example pattern below—edit it or paste your own. All processing runs in your browser. For Python’s re module, switch flavor in the tool.

Flavor

Standard `RegExp` for explanation and preview.

g i m s u y d v (JavaScript)
id: 550e8400-e29b-41d4-a716-446655440000 and 6ba7b810-9dad-11d1-80b4-00c04fd430c8

Plain-English explanation

Flavor: JavaScript RegExp

Flags: g (find all matches)

a word boundary Then Match one character from: characters from the character "0" to the character "9", characters from the character "a" to the character "f", characters from the character "A" to the character "F", repeated exactly 8 times. Then Match the character "-". Then Match one character from: characters from the character "0" to the character "9", characters from the character "a" to the character "f", characters from the character "A" to the character "F", repeated exactly 4 times. Then Match the character "-". Then Match one character from: characters from the character "0" to the character "9", characters from the character "a" to the character "f", characters from the character "A" to the character "F", repeated exactly 4 times. Then Match the character "-". Then Match one character from: characters from the character "0" to the character "9", characters from the character "a" to the character "f", characters from the character "A" to the character "F", repeated exactly 4 times. Then Match the character "-". Then Match one character from: characters from the character "0" to the character "9", characters from the character "a" to the character "f", characters from the character "A" to the character "F", repeated exactly 12 times. Then a word boundary

More examples

Back to RegExplain