I'm trying to create a regex pattern to find a german address (Street + Nr + ZIP + City) Exeample "Hauptstr. 5 - 59969 Hallenberg"
I have an individual pattern for Street + Nr (StreetNr)
@"^\s*((?:(?:A[nm]|Auf|Vor|In|Im|Der|Dem|Die|Das|Bei|Alt|Zu[mr]?|Sk?t[.,]?[-_]?|Dr[.,]?[-_]?|Prof[.,]?[-_]?|De[-_]?)" +
@"(?:\s*(?>Sk?t[,.]?|und|von|der|dem|des|den|in\s?der))?\s?)?" +
@"(?>(?:[\w-[0-9]]{3}(?:[-_.,]|\s+))|(?:[\w-[0-9]](?:[/.,\w-[0-9]]){3,})|(?:[\w-[0-9]][/.,][-_]?\s?){1,4}\s*[\w-[0-9]]{3,})?\s?" +
@"(?>[-_]?\s?[/.\w-[0-9]]{2,}){0,5}\s*(?>[-_]?\s?str\.{0,1}|17\.Juni|strasse|straße|platz|hof|weg|ring){0,1})\s*." +
@"(\d{1,4}[a-z]?(?>\s?[-_]\s?\d{1,4}[a-z]?)?)\s*$"
and another one for ZIP + City (ZIPCity)
@"^\s*(?:(?:D|DE)\s?[-_]?\s?){0,1}([0-9]{5})\s+([\w-[0-9]]+" +
@"(?>\s?[-_/]?\s?[\w-[0-9]]+){0,5})\s*$",
1- What I First need is help with the ZIPCity pattern once the String is "59969 Hallenberg" the pattern match, but if there is any special char before the ZIP the pattern unfortunatly don't match What I need for example " - 59969 Hallenberg", " -59969 Hallenberg" "- 59969 Hallenberg" or "59969 Hallenberg" I need to finde "59969 Hallenberg". "-" is just an example as it could be any non alphanumeric character. and it should be optional
2- I need a combination of the two patterns to find the entire address "Hauptstr. 5 - 59969 Hallenberg". It should only match if the address is complete (the alphanumeric character in the example "-" should always be optional).