use strict;
my $str = '{Client:100.96.43.15,ElapsedMilliseconds:214,EndTime:2019-10-02T20:18:56.027320,Failed:0,Name:MasterAddress,Results:[{ElapsedMilliseconds:213,EndTime:2019-10-02T20:18:56.027291,Result:{AddressTypeCode:STANDARD,ID:00A-27P-15Q,Municipality:{Name:Windsor,StateProvince:{Code:ON,Country:{Code:CA}}},PostalCode:{Value:N8S0A1},Street:{Name:McHugh,StreetType:{Abbreviation:{en:St,fr:St},Value:{en:Street,fr:Street}}},StreetNumber:8787},StartTime:2019-10-02T20:18:55.813313,Success:true}],Server:master-address-68bf54d578-vczph,StartTime:2019-10-02T20:18:55.813162,StatusCode:200,Succeeded:1,TimedOut:0,Version:1.0}
';
my $regex = qr/failed:.*\,/mip;
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