From d9bc465c82d96fa915f5b4680610a9e792234558 Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 19 Oct 2016 17:46:37 -0400 Subject: [PATCH] [osm] parsing out semicolon-delimited postal codes from OSM in countries like Poland that use hyphen delimited postcodes without treating them as number ranges --- scripts/geodata/osm/formatter.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/geodata/osm/formatter.py b/scripts/geodata/osm/formatter.py index 77b71155..840401d5 100644 --- a/scripts/geodata/osm/formatter.py +++ b/scripts/geodata/osm/formatter.py @@ -457,11 +457,14 @@ class OSMAddressFormatter(object): valid_postcode = False if validate: postcode_regex = postcode_regexes.get(country) + values = number_split_regex.split(postal_code) + if postcode_regex: - match = postcode_regex.match(postal_code) - if match and match.end() == len(postal_code): - valid_postcode = True - postal_codes.append(postal_code) + for p in values: + match = postcode_regex.match(p) + if match and match.end() == len(p): + valid_postcode = True + postal_codes.append(p) else: valid_postcode = True