import re
regex = re.compile(r"=> ([A-Z0-9]{6})\)", flags=re.MULTILINE)
test_str = ("Array([0] => Array([0] => CLASSI[1] => LEATHE[2] => 0MEFCQ))\n\n"
"VANS CLASSIC SLIP-ON CROC LEATHER 0MEFCQ 36-40\n\n"
"([0] => Array([0] => TRAMPK[1] => XH8GKA))\n\n"
"NOWE TRAMPKI VANS SK8-HI SLIM ZIP XH8GKA 36-40\n\n"
"([0] => Array([0] => DAMSKI[1] => TRAMPK[2] => AUTHEN[3] => EE3W00))\n\n"
"DAMSKIE TRAMPKI VANS AUTHENTIC EE3W00 35-41")
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