import re
regex = re.compile(r".*(?=\/)", flags=re.MULTILINE)
test_str = "https://www.businessinsider.de/gruenderszene/plus-angebot/?tpcc=onsite_gs_header_nav&verification_code=DOVCGF75J8LSID&_ptid=%7Bkpdx%7DAAAA0Urc6Ir0lQoKN245U3NTVndwdRIQbDVoMzl2NW11ZXgxamJhZRoMRVhGU0NHMjRJVElTIiUxODA1YXZvMGNrLTAwMDAzMGZlaHRldTM0OWl0MGpvYXAzczRvKhdzaG93T2ZmZXJCTEFYWVFVTEdNTUMxODABOgxPVEo4RDNFUUQzTzRKIm9uc2l0ZV9nc19oZWFkZXJfbmF2OjE2NTc1NjQ3ODE4MTZSEnYtlgDwFnFubndiNG1rWgw5My4xOTUuMTIuOTliA21pc2ju_7aWBnAHeAw"
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