// 手機號驗證正則表達式
1 func validateMobile(phoneNum:String)-> Bool { 2 3 // 手機號以 13 14 15 18 開頭 八個 /d 數字字符 4 5 let phoneRegex = "^((13[0-9])|(17[0-9])|(14[^4,//D])|(15[^4,//D])|(18[0-9]))//d{8}$|^1(7[0-9])//d{8}$"; 6 7 let phoneTest = NS 8 9 return (phoneTest.evaluateWithObject(phoneNum));10 11 }
新聞熱點
疑難解答