uuid property

Map<String, RegExp> uuid
final

Matches UUIDs by version.

  • uuid['3']: Matches UUID version 3
  • uuid['4']: Matches UUID version 4
  • uuid['5']: Matches UUID version 5
  • uuid['all']: Matches any valid UUID

Use Case: API keys, database identifiers, sessions

Implementation

static final Map<String, RegExp> uuid = {
  '3': RegExp(r'^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$'),
  '4': RegExp(r'^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$'),
  '5': RegExp(r'^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$'),
  'all': RegExp(r'^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$'),
};