use strict;
my $str = '<13>Apr 20 16:19:36 SERVERNAME.domain.net 1,2021/04/20 16:19:36,013244444796,THREAT,data,2049,2021/04/20 16:19:36,1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,FWRULE NAME,,,sharepoint-online-uploading,vsys1,fwrulename,zone,protocol.stuff,ethernet1/1,SourceOS,2021/04/20 16:19:36,34916,1,49538,443,11070,443,0x1406000,tcp,alert,"\'FILE_01.docx\'",DataPattern-Conf(60004),computer-and-internet-info,low,client-to-server,69181231233089036,0xa000000000000000,100.0.0.0-100.255.255.255,United States,0,,0,,,3,,,,,,,,0,13,14,35,11,,SERVERNAME,,,,,0,,0,,N/A,unknown,AppThreat-0-0,0x0,0,424949495,';
my $regex = qr/(?:[^,]*\,){9}(.*?)\,/p;
if ( $str =~ /$regex/ ) {
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