Skip to main content
AllDevToolsHub
Back to all patterns

Tracking ID (UUID v4 or ULID)

Validation

Matches either a UUID v4 or a ULID, common identifiers in distributed tracing.

/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9A-HJKMNP-TV-Z]{26})$/i

How it works

Many observability systems accept both UUID v4 and ULID as trace/span IDs. This alternation matches either, letting you parse either format with a single regex.

Test Cases

Should Match

  • 550e8400-e29b-41d4-a716-446655440000
  • 01HZQF8R7P5G2YZ8M4R3K2J5XW

Should NOT Match

  • 12345
  • 550e8400-e29b-31d4-a716-446655440000

Quick Summary

Matches either a UUID v4 or a ULID, useful for distributed tracing IDs that accept both.