I want to check the password’s complexity with regular expression.
But it returns always true?
The password’s complexity is the following. Allowed are:
- A-Z
- a-z
- 0-9
- special characters: – _ , ; . : # + * ? = ! § $ % & / ( ) @
- No blank characters
Here is my code:
NSString *regExPwd = @"[a-zA-Z_0-9\\-_,;.:#+*?=!§$%&/()@]+";
NSPredicate *pwdCheck = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regExPwd];
bool isValid = [pwdCheck evaluateWithObject:txtPassword.text];
Hope you can help me once again 🙂
You should require that there are only allowed characters from the beginning to the end: