import re
regex = re.compile(r"https\:\/\/www\.bugaboo\.com\/.{2}\-.{2}\/(silla\-de\-coche|siege\-auto|autostoel|autokindersitz|car\-seat|babyskydd|seggiolino\-auto)\/", flags=re.MULTILINE)
test_str = ("https://www.bugaboo.com/gb-en/car-seat/\n\n"
"https://www.bugaboo.com/es-es/silla-de-coche/\n"
"https://www.bugaboo.com/es-en/car-seat/\n\n"
"https://www.bugaboo.com/fr-fr/siege-auto/\n"
"https://www.bugaboo.com/fr-en/car-seat/\n\n"
"https://www.bugaboo.com/de-de/autokindersitz/\n"
"https://www.bugaboo.com/de-en/car-seat/\n\n"
"https://www.bugaboo.com/nl-nl/autostoel/\n"
"https://www.bugaboo.com/nl-en/car-seat/\n\n"
"https://www.bugaboo.com/sv-se/babyskydd/\n"
"https://www.bugaboo.com/se-en/car-seat/\n\n"
"https://www.bugaboo.com/it-it/seggiolino-auto/\n"
"https://www.bugaboo.com/it-en/car-seat/\n\n"
"https://www.bugaboo.com/dk-en/car-seat/\n\n"
"https://www.bugaboo.com/at-de/autokindersitz/\n"
"https://www.bugaboo.com/at-en/car-seat/\n\n"
"https://www.bugaboo.com/be-fr/siege-auto/\n"
"https://www.bugaboo.com/be-en/car-seat/\n"
"https://www.bugaboo.com/be-nl/autostoel/\n\n"
"https://www.bugaboo.com/ie-en/car-seat/\n\n"
"https://www.bugaboo.com/fi-en/car-seat/\n\n"
"https://www.bugaboo.com/hu-en/car-seat/\n\n"
"https://www.bugaboo.com/hr-en/car-seat/\n\n"
"https://www.bugaboo.com/si-en/car-seat/\n\n"
"https://www.bugaboo.com/lu-fr/siege-auto/\n"
"https://www.bugaboo.com/lu-en/car-seat/\n\n"
"https://www.bugaboo.com/cz-en/car-seat/\n\n"
"https://www.bugaboo.com/pt-en/car-seat/\n\n"
"https://www.bugaboo.com/sk-en/car-seat/")
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