Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?n)(?i:{[a-f\d]{8}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{12}})| (?i:\([a-f\d]{8}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{12}\))| (?i:[a-f\d]{8}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{4}-?[a-f\d]{12})| {0x[a-fA-F\d]{8},0x[a-fA-F\d]{4},0x[a-fA-F\d]{4},{0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2},0x[a-fA-F\d]{2}}}
/
gx

Description

Match uppercase or lowercase GUIDs in any of the following formats:

  • 00000000-0000-0000-0000-000000000000
  • 00000000000000000000000000000000
  • {00000000-0000-0000-0000-000000000000}
  • (00000000-0000-0000-0000-000000000000)
  • {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
Submitted by https://github.com/brentjs0 - 3 years ago