주어진 :
"4 John Smith Rd., Pasadena 94786"
또는
"4 John Smith Rd., North Pasadena 94786".
다음 정규식은 배열 인덱스 0의 도시와 배열 인덱스의 우편 번호를 추출하지 못했습니다.
그것을 고치는 방법? 고마워
doc.address.match(/, (\w+) +(\d{5})/g);
var address = ["4 John Smith Rd., Pasadena 94786",
"4 John Smith Rd., North Pasadena 94786"
]
for(var i in address){
console.log(address[i].match(/, (.+)? +(\d{5})/));
}
group1은 도시이고 group2는 우편 번호입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다