Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

match city regex

const address = "One Infinite Loop, Cupertino 95014";
const cityZipCodeRegex = /^[^,]+[,s]+(.+?)s*(d{5})?$/;
const [_, city, zipCode] = address.match(cityZipCodeRegex) || [];
saveCityZipCode(city, zipCode);
Source by awesomeopensource.com #
 
PREVIOUS NEXT
Tagged: #match #city #regex
ADD COMMENT
Topic
Name
3+8 =