use strict;
my $str = 'e876c866-1dd6-4c32-bf27-7ab673b57f75
d9da6fe0-cf69-40ae-9263-a115aac94441
bc783e58-3cac-4efb-92ee-560b696674c8
7b054304-c5dd-4595-a390-fd4f4b700e33
20255eea-5679-4fa7-8e65-4bab69425727
8039e4c6-4032-4065-8723-b0351d4a33f0
e9b3f927-b87a-459a-8a5b-caba3ccc8968
edbdb831-6e92-4241-8ba9-0bba71a1d7b0
087b5b52-97e6-4341-8976-59674ecbef2d
d78be4c5-a0ba-4ef4-ab77-97585aa61436';
my $regex = qr/(?i)[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}/mp;
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