I am unsure how to tell a regular expression in Python to stop after finding the first match.
Apparently you can tell regex to be lazy, RegEx - stop after first match , I tried placing (.*?) at the end of my expression but that just broke it. I just want it to stop after finding the first complete address and return that.
Sample code with data: https://regexr.com/6okuv
In the sample data all addresses are accepted by the expression except "Hindenburgdamm 27, Hygiene-Institut" where it should stop after "27" and return "Hindenburgdamm 27" and "Peschkestr. 5a/Holsteinische Str. 44" where it should stop after "5a" and return "Peschkestr. 5a".
Regex expression :
^([A-Za-zÄäÖöÜüß\s\d.-]+?)\s*([\d\s]+(?:\s?[-+/]\s?\d+)?\s*[A-Za-z]?-?[A-Za-z]?)?$
Sample data:
Berliner Str. 74
Hindenburgdamm 27, Hygiene-Institut
Peschkestr. 5a/Holsteinische Str. 44
Lankwitzer Str. 13-17a
Fidicinstr. 15A
Haudegen Weg 15/17
Johanna-Stegen-Strasse 14a-d
Friedrichshaller Str. 7
Südwestkorso 9