import re
regex = re.compile(r".*?1920x1200.*$(*SKIP)(*F)|(?:\d+[a-z]|[a-z]+\d)[a-z\d]*", flags=re.IGNORECASE | re.MULTILINE)
test_str = ("group1:\n"
"2aa\n"
"a2\n"
"2aaaaaa\n"
"aaaa2\n"
"aaa2aaaa\n"
"2222a2222-2222-aaaa\n"
"sdfzugsdufz-aaaaa7-7aaaa\n"
"sdfz/////...ugsd33ufz_//__-aaaaa7__///-7aaaa\n\n"
"group-two:\n"
"aaaaaa\n"
"22222\n"
"aaa-222-aaa-aaa\n"
"aaaaa222aaa1920x1200bbbbb1234556789\n"
"aaa1920x1200-\n"
"aaaaf344t---1920x1200aaa------\n"
"aaaaaaaaaaaaaaaaa-1920x1200\n"
"aa456456a-1920x1200-dfgfdg656dfg")
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