iOS 正则 检测是否为手机号
- (BOOL)validateMobile:(NSString *)mobileNum { NSString *regex = @"^1[3|5|7|8][0-9]\\d{8}$"; NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; if(![pred evaluateWithObject:mobileNum]) { return NO; } else { return YES; } }