re = /(?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}}}
/x
str = 'string str = @"
50de1696-8c63-4856-a204-7f4d93082da8
AB9B479D-3E48-49B7-A3B9-3BEC6ADEE344
d1ce1bec29434df09a03fc0605a2b481
DC9A9DA1D9D448DA8B9BDC401E20BA69
{8f60f165-38f9-42ad-95d2-22b746de1cba}
{DC9A9DA1-D9D4-48DA-8B9B-DC401E20BA69}
(f4e06eae-58d2-4daa-9f2d-917f622d23ea)
(DC9A9DA1-D9D4-48DA-8B9B-DC401E20BA69)
{0xB7D3E6C4,0x7FA6,0x4C48,{0xBA,0x0A,0x44,0x58,0x9D,0x14,0xE5,0x12}}
{0xf3ffac91,0xc8cd,0x434d,{0x9f,0x2d,0x78,0x93,0x9b,0xa4,0x82,0x1d}}
";'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html