UUID/GUID Validation Regex

Validate UUIDs (Universally Unique Identifiers) and GUIDs in standard 8-4-4-4-12 format.

Pattern & Test String

About This Pattern

Pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

Flags: g

Results

Enter a regex pattern to see the results here.

Frequently Asked Questions

What is a UUID?

A UUID (Universally Unique Identifier) is a 128-bit number represented as 32 hexadecimal digits separated by hyphens in 8-4-4-4-12 format.

Does this validate UUID versions?

No, this matches the general format. To validate specific versions (v1, v4, etc.), you need additional checks on the version and variant bits.

Are UUIDs and GUIDs the same?

Essentially yes. GUID (Globally Unique Identifier) is Microsoft's implementation of the UUID standard.

Practical Examples

Database Record IDs

Validate UUID primary keys in API requests or database queries.

API Token Validation

Verify UUID-format tokens or session identifiers.

File Naming

Validate UUID-based file names for uniqueness.

Common Issues & Solutions

To match UUIDs without hyphens, use: ^[0-9a-fA-F]{32}$ and normalize input.

For case-insensitive matching, use the 'i' flag or convert to lowercase before validation.

To validate specific UUID versions, check the version digit (13th hex digit): 1-5 for v1-v5.