Following is the regex that I am currently using for validating passwords: at least one uppercase character, at least one lowercase character, at least one number and minimum 8 characters in length.
func isValidPassword() -> Bool {
let passwordRegEx = "^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{8,}$"
return NSPredicate(format:"SELF MATCHES %@", passwordRegEx).evaluate(with: self)
}
I would now like to include special characters and update the validation rule as follows.
minimum 8 characters in length, should include at least 3 of these: uppercase character, lowercase character, number and special character.
What would be the regex for this requirement?