字母数字混合密码校验
2018-12-10 本文已影响0人
小风车tl
- (BOOL)checkPassword:(NSString *) password{
NSString *pattern = @"^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z0-9]{6,15}";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES%@",pattern];
BOOL isMatch = [pred evaluateWithObject:password];
return isMatch;
}