Test, validate and match regular expressions
This complex regex matches Global Unique Identifiers (GUIDs) or Universally Unique Identifiers (UUIDs) in both hyphenated and non-hyphenated formats. It supports standard GUIDs enclosed in curly braces as well as those without them, ensuring a matched pair if braces are present. It strictly validates the 32 hexadecimal characters and enforces that there are either exactly four hyphens or none at all. It is designed for JavaScript and utilizes the global and multiline flags.