import re
regex = re.compile(r"(?:[^,]*,){52}(?<host>\w+)")
test_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"
matches = regex.finditer(test_str)
for match_num, match in enumerate(matches, start=1):
print(f"Match {match_num} was found at {match.start()}-{match.end()}: {match.group()}")
for group_num, group in enumerate(match.groups(), start=1):
print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")
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 Python, please visit: https://docs.python.org/3/library/re.html