//判断密码6-16位 + (BOOL)validatePassword:(NSString *)password{ NSString *Regex = @"^[a-zA-Z0-9]{5,16}$"; NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", Regex]; return [emailTest evaluateWithObject:password]; } //判断手机号11位 + (BOOL)validateMobile:(NSString *)mobileNum{ NSString *MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\d{8}$"; NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",MOBILE]; return [regextestmobile evaluateWithObject:mobileNum]; }