use strict;
my $str = '{"0-0:96.1.1":{"value":"54978381"},"0-0:1.0.0":{"value":0,"time":1696963760},"1-0:1.8.0":{"value":743,"time":1696963760},"1-0:2.8.0":{"value":0,"time":1696963760},"1-0:3.8.0":{"value":0,"time":1696963760},"1-0:4.8.0":{"value":203,"time":1696963760},"1-0:1.7.0":{"value":303443.1,"time":1696963760},"1-0:2.7.0":{"value":612.3,"time":1696963760},"1-0:3.7.0":{"value":541.3,"time":1696963760},"1-0:4.7.0":{"value":140247.8,"time":1696963760},"0-0:2.0.0":{"value":1653,"time":0},"api_version":"v1","name":"54978381","sma_time":8291.3}';
my $regex = qr/"([\d\-\:\.]+)":{"value":"?([\d]+)"?/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