fork(20) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string input = "Random string CA761232-ED42-11CE-BACD-00AA0057B223 random string";
  9.  
  10. Match match = Regex.Match(input,
  11. @"((?:(?:\s*\{*\s*(?:0x[\dA-F]+)\}*\,?)+)|(?<![a-f\d])[a-f\d]{32}(?![a-f\d])|" +
  12. @"(?:\{\(|)(?<![A-F\d])[A-F\d]{8}(?:\-[A-F\d]{4}){3}\-[A-F\d]{12}(?![A-F\d])(?:\}|\)|))");
  13.  
  14. if (match.Success)
  15. {
  16. string key = match.Groups[1].Value;
  17. Console.WriteLine(key);
  18. }
  19. else
  20. {
  21. Console.WriteLine("NO MATCH");
  22. }
  23. }
  24. }
Success #stdin #stdout 0.07s 37344KB
stdin
Standard input is empty
stdout
CA761232-ED42-11CE-BACD-00AA0057B223