use strict;
my $str = '03712 -R->13:29:23:265 uRD 778 ReadStat 20,01,00,[OS:T------- OP:----B--- TS:----- - ---** --*---* ****--]01,9a,80,08,0a,13,00,64,7c,00,14,10,11,01,01,00,00,00,00,00,03,00,00,00,00,00,00,c9,21,00,aa,12,11,00,00,10,0a,bb,01,00,03,01,00,00,cc,01,00,01,01,00,00,01,01,dd,08,27,3b,02,00,02,ee,1a,02,80,00,00,ff,00,aa,01,00,03,00,01,00,00,00,rc=00';
my $regex = qr/(\d{2}:\d{2}:\d{2}:\d{3}).+(\[.{55}])/p;
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