I've a regex check for my email parameter, I want to implement regex check as well for password parameter.
For my email account I do something like this:
- (BOOL)isValidEmailAddress:(NSString*)emailAddressToCheck
{
BOOL stricterFilter = YES;
NSString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSString *laxString = @".+@.+\\.[A-Za-z]{2}[A-Za-z]*";
NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:emailAddressToCheck];
}
But I wonder how can I do it for password parameter check:
- What I want to achieve is password with repeated character more than 3 times is not allowed.
- 1, 2, 3 OR 3, 2, 1 for example is not allowed.
- Letters and numbers.
Any ideas how can I do that?