I am trying to validate a password field using regex in Swift/iOS the feature of the passwords are:
- 1 uppercase at least
- 1 number at least
(other than that lowercase and symbols are allowed of course, but those are the required)
this is my current RegEx format:
let passwordRegex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[*.!@$%^&(){}[]:;<>,.?/~_+-=|\\])$"
this is my password: Test@123
When I run the simulator it errors with the following:
Thread 1: "Can't do regex matching, reason: Can't open pattern U_REGEX_MISSING_CLOSE_BRACKET (string Test@123, pattern ^(?=.[0-9])(?=.[a-z])(?=.[A-Z])(?=.[*.!@$%^&(){}[]:;<>,.?/~_+-=|\])$, case 0, canon 0)"
What is wrong whith my RegEx string?