fork download
  1. import re
  2. s = "Ladegårdsvej 8B7100 Vejle"
  3. m = re.search(r"(.*)([0-9]{4})\s+(.*)", s)
  4. if m:
  5. print("Item1: {}\nItem2: {}\nItem3: {}".format(m.group(1), m.group(2), m.group(3)))
Success #stdin #stdout 0.02s 28376KB
stdin
Standard input is empty
stdout
Item1: Ladegårdsvej 8B
Item2: 7100
Item3: Vejle