// 判断长度大于8位后再接着判断是否同时包含数字和字符
- (BOOL)judgePassWordLegal:(NSString *)pass{
BOOL result = false;
if ([pass length] >= 8){
// 判断长度大于8位后再接着判断是否同时包含数字和字符
NSString * regex = @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
result = [pred evaluateWithObject:pass];
}
return result;
}
- (BOOL)judgePassWordLegal:(NSString *)pass{
BOOL result = false;
if ([pass length] >= 8){
// 判断长度大于8位后再接着判断是否同时包含数字和字符
NSString * regex = @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
result = [pred evaluateWithObject:pass];
}
return result;
}