Regex for splitting a german address into its parts

前端 未结 6 749
孤街浪徒
孤街浪徒 2021-02-09 18:09

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 t

6条回答
  •  无人共我
    2021-02-09 18:41

    Here is my suggestion which could be fine-tuned further e.g. to allow missing parts.

    Regex Pattern:

    ^([^0-9]+) ([0-9]+.*?) ([0-9]{5}) (.*)$
    
    • Group 1: Street
    • Group 2: House no.
    • Group 3: ZIP
    • Group 4: City

提交回复
热议问题