驗證密碼字符串(正則表達式)

+(BOOL)checkPassword:(NSString*)pass
{
    NSString *regex = @"^[A-Za-z0-9]+$";
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@ AND SELF.length > 3 AND SELF.length < 16", regex];
    return [predicate evaluateWithObject:pass];
}
相關文章
相關標籤/搜索