X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/5e477e3b5b99da6fc4e54749d4671a6fc8fdcd66..0278ab7f41bf9bc96a87084c04bfec263c6acc40:/nominatim/data/postcode_format.py 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>')