//邮箱
@H_404_4@- (BOOL) validateEmail:(NSString *)email @H_404_4@{NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
@H_404_4@ NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",emailRegex]; @H_404_4@ return [emailTest evaluateWithObject:email]; @H_404_4@}//手机号码验证
@H_404_4@- (BOOL) validateMobile:(NSString *)mobile @H_404_4@{//手机号以13,14,15,18开头,八个 \d 数字字符
NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9])|(14[0-9]))\\d{8}$";
@H_404_4@ NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex]; @H_404_4@ return [phoneTest evaluateWithObject:mobile]; @H_404_4@}//密码
@H_404_4@- (BOOL) validatePassword:(NSString *)passWord @H_404_4@{// NSString *passWordRegex = @"^[a-zA-Z0-9]{6,20}+$"; 密码是数字或者字母
NSString *passWordRegex = @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$";//密码是数字或者字母,且不能全部是数字,全部是字母
@H_404_4@ NSPredicate *passWordPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",passWordRegex]; @H_404_4@ return [passWordPredicate evaluateWithObject:passWord]; @H_404_4@}//身份证号
@H_404_4@- (BOOL) validateIdentityCard: (NSString *)identityCard @H_404_4@{ @H_404_4@ BOOL flag; @H_404_4@ if (identityCard.length <= 0) { @H_404_4@ flag = NO; @H_404_4@ return flag; @H_404_4@ }NSString *regex2 = @"^(\\d{14}|\\d{17})(\\d|[xX])$";
@H_404_4@ NSPredicate *identityCardPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex2]; @H_404_4@ return [identityCardPredicate evaluateWithObject:identityCard]; @H_404_4@}