match city regex

Solutions on MaxInterview for match city regex by the best coders in the world

showing results for - "match city regex"
Beatrice
23 Oct 2016
1const address = "One Infinite Loop, Cupertino 95014";
2const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
3const [_, city, zipCode] = address.match(cityZipCodeRegex) || [];
4saveCityZipCode(city, zipCode);
5
queries leading to this page
address regexmatch city regex