- (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;
}
}
是手机号,返回YES,不是手机号,返回NO