📌  相关文章
📜  匹配城市正则表达式 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:04.499000             🧑  作者: Mango

代码示例1
const address = "One Infinite Loop, Cupertino 95014";
const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
const [_, city, zipCode] = address.match(cityZipCodeRegex) || [];
saveCityZipCode(city, zipCode);