import re
regex = re.compile(r"(.*?),(.*?),'(.*?),'(.*?),'(.*?),'(.*?),(.*)", flags=re.MULTILINE)
test_str = ("2016/11/09,12:10:00,'4355,'4358,'4346,'4351,1,201\n"
"2016/11/09,12:09:00,'4361,'4362,'4353,'4355,1,117\n"
"2016/11/09,12:08:00,'4364,'4374,'4359,'4360,10,175\n"
"2016/11/09,12:07:00,'4371,'4376,'4360,'4365,590\n"
"2016/11/09,12:06:00,'4359,'4372,'4358,'4369,420\n"
"2016/11/09,12:05:00,'4365,'4367,'4356,'4359,542\n"
"2016/11/09,12:04:00,'4379,'1380,'4360,'4365,1,697\n"
"2016/11/09,12:03:00,'4394,'4396,'4376,'4381,1,272\n"
"2016/11/09,12:02:00,'4391,'4399,'4390,'4393,524")
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