use strict;
my $str = ' Feb 15 10:21:05 test01pano.xxxxxx.com 1,2018/02/15 10:21:05,012501001022,TRAFFIC,end,1,2018/02/15 10:21:04,10.x.x.x,10.x.x.x,0.0.0.0,0.0.0.0,DXXXXX_not_here,,,ssl,vsys2,Data-Center-Admin,Data-Center-Core,ae5.2005,ae5.250,pan_log_forward,2018/02/15 10:21:04,69938101,1,44400,9080,0,0,0x100053,tcp,allow,xxxx,xxxx,xxxx,22,2018/02/15 10:20:40,22,not-resolved,0,6486906217785415243,0x8000000000000000,10.0.0.0-10.x.x.x,10.0.0.0-10.x.x.x,0,12,10,tcp-rst-from-client,19,0,0,0,Data_Center,dwest01fw,from-policy,,,0,,0,,N/A';
my $regex = qr/(?:[^,]*,){52}(?<host>\w+)/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