//正则过滤
NSString *regex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isMatch = [pred evaluateWithObject:@"手机号"];
//
if (!isMatch) {
//非手机号
}
//正则过滤
NSString *regex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isMatch = [pred evaluateWithObject:@"手机号"];
//
if (!isMatch) {
//非手机号
}
转载于:https://www.cnblogs.com/helonghl/p/5109706.html