I want to implement a regex validaton for passwords in Swift? I have tried the following regex, but not successful
([(0-9)(A-Z)(!@#$%ˆ&*+-=<>)]+)([
func isValidPassword() -> Bool {
// least one uppercase,
// least one digit
// least one lowercase
// least one symbol
// min 8 characters total
let password = self.trimmingCharacters(in: CharacterSet.whitespaces)
let passwordRegx = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&<>*~:`-]).{8,}$"
let passwordCheck = NSPredicate(format: "SELF MATCHES %@",passwordRegx)
return passwordCheck.evaluate(with: password)
}