Closed StephanGeorg closed 1 year ago
Canadian postformat_replace regex (\\w{2}) (\\w{3})(\\w{3})\n has side effects when applied to abbreviated street types:
postformat_replace
(\\w{2}) (\\w{3})(\\w{3})\n
Input
{ "road": "Av Demars", "house_number": "12345", "postcode": "J2T 3T5", "city": "St-Hyancinth", "countryCode" : "CA" }
Output
{ "formattedAddress": [ "12345 Av Dem ars", "St-Hyancinth, J2T 3T5" ] }
Solution Replace postformat_replace with more strict postal code regex: ([A-Za-z]{2}) ([A-Za-z]\\d[A-Za-z])(\\d[A-Za-z]\\d)
([A-Za-z]{2}) ([A-Za-z]\\d[A-Za-z])(\\d[A-Za-z]\\d)
well spotted. can you submit a pull request. Ideally with a test case in testcases/countries/ca.yaml please
testcases/countries/ca.yaml
Canadian
postformat_replace
regex(\\w{2}) (\\w{3})(\\w{3})\n
has side effects when applied to abbreviated street types:Input
Output
Solution Replace
postformat_replace
with more strict postal code regex:([A-Za-z]{2}) ([A-Za-z]\\d[A-Za-z])(\\d[A-Za-z]\\d)