use strict;
my $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}}
";';
my $regex = qr/(?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}}}
/xp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html