Reputation: 75
I'm very new to regex and was wondering if there was a quick way for me to include all the special characters in this regexp without tediously typing them all out?
# Need 1 char of A-Z, a-z, 0-9, special character and 12 characters min
config.password_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!"'@#$&* £])(?=.{12,})/
Upvotes: 0
Views: 76
Reputation: 29431
The closer you can get without having issues with new lines in a password is:
[^\w\s]
which means not a whitespace nor a char in the range a-z nor a digit
Upvotes: 1