- (BOOL)judgePassWordLegal:(NSString*)pwd{
BOOLresult =false;
if([pwdlength] >=6){
// 判断长度大于8位后再接着判断是否同时包含数字和字符
NSString * regex = @"^([0-9]|[a-zA-Z]){6,17}$";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
result = [predevaluateWithObject:pwd];
}
returnresult;
}
正则表达式相关:http://www.cnblogs.com/zxin/archive/2013/01/26/2877765.html
密码包含数字和字母:https://blog.csdn.net/u011156012/article/details/47251553