對比下圖
image.png
現在還沒有 92和98的手機號,之后會有的
// 手機號
const mobileRule = /(?:^1[3456789]|^9[28])\d{9}$/
image.png
// 座機
const phoneRule = /^[0]?\d{2,3}[- ]?\d{7,8}$/
image.png
// 座機及手機
const telephoneRule = /^[0]?\d{2,3}[- ]?\d{7,8}$|(?:^1[3456789]|^9[28])\d{9}$/
image.png