X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bc7f6209d83dcc161f093ce9907991facabb3491..b0067a0345c2ab7793614925d6150141ef5f18f0:/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>')