use strict;
my $str = 'fab4cc07260bc73302a2653aa2b0e6de
46cc38cc1039848dc287162cc4cf2532
a065c2cf24295a13725af9c5dc8cc76c
87d0f33c047915a0000ca972f3b32adc
43da9d5db71bedf3afc6f10fc8297a00
3fcca411d6774571a81a9faa4026c69a
9f36002354b2b75a069facac88ce5651
064ec24407084bf597c7dc1edc3f9017
3f5cfb400d72c7b3663b617368a0b3af';
my $regex = qr/^[0-9A-F]{32}$/imp;
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