use strict;
my $str = 'xxx <xx>x 2020-02-07T18:57:21.980698+00:00 xxxxxx.prod.xxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx [APP/PROC/WEB/0] - - 2020-02-07 18:57:21.980+0000 org{xxxxxxxx} INFO x.x.x.x.x.x.implementation.WorkflowAPI [] [] [] [{count=55.0, state=STATE_ONE}, {count=10.0, state=STATE_TWO}, {count=13.0, state=STATE_THREE}, {count=12.0, state=STATE_FOUR}, {count=11.0, state=STATE_FIVE}, {count=14.0, state=STATE_SIX}, {count=1.0, state=STATE_SEVEN}, {count=69.0, state=STATE_NINE}, {count=420.0, state=STATE_ELEVEN}]';
my $regex = qr/(?:count=)(?P<G1>\d+(?=\.0, state=STATE_ONE))?(?P<G2>\d+(?=\.0, state=STATE_TWO))?(?P<G3>\d+(?=\.0, state=STATE_THREE))?(?P<G4>\d+(?=\.0, state=STATE_FOUR))?(?P<G5>\d+(?=\.0, state=STATE_FIVE))?(?P<G6>\d+(?=\.0, state=STATE_SIX))?(?P<G7>\d+(?=\.0, state=STATE_SEVEN))?(?P<G8>\d+(?=\.0, state=STATE_EIGHT))?(?P<G9>\d+(?=\.0, state=STATE_NINE))?(?P<G10>\d+(?=\.0, state=STATE_TEN))?(?P<G11>\d+(?=\.0, state=STATE_ELEVEN))?/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