X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/5e477e3b5b99da6fc4e54749d4671a6fc8fdcd66..d9d0e70e5ba966b8c33ff17a14f1f809fdcb16c9:/nominatim/data/postcode_format.py?ds=sidebyside diff --git a/nominatim/data/postcode_format.py b/nominatim/data/postcode_format.py index dad35b7a..132dd41f 100644 --- a/nominatim/data/postcode_format.py +++ b/nominatim/data/postcode_format.py @@ -25,7 +25,7 @@ class CountryPostcodeMatcher: pc_pattern = config['pattern'].replace('d', '[0-9]').replace('l', '[A-Z]') - self.norm_pattern = re.compile(f'\\s*(?:{country_code.upper()}[ -]?)?(.*)\\s*') + self.norm_pattern = re.compile(f'\\s*(?:{country_code.upper()}[ -]?)?({pc_pattern})\\s*') self.pattern = re.compile(pc_pattern) self.output = config.get('output', r'\g<0>')