Regex for splitting a german address into its parts
- by Christian
Good evening,
I'm trying to splitting the parts of a german address string into its parts via Java. Does anyone know a regex or a library to do this? To split it like the following:
Name der Straße 25a 88489 Teststadt
to
Name der Straße|25a|88489|Teststadt
or
Teststr. 3 88489 Beispielort (Großer Kreis)
to
Teststr.|3|88489|Beispielort (Großer Kreis)
It would be perfect if the system / regex would still work if parts like the zip code or the city are missing.
Is there any regex or library out there with which I could archive this?
EDIT: Rule for german addresses:
Street: Characters, numbers and spaces
House no: Number and any characters (or space) until a series of numbers (zip) (at least in these examples)
Zip: 5 digits
Place or City: The rest maybe also with spaces, commas or braces