I am trying to check the password string using javascript and you need help with regex. I tried some tutorials, but I think I have some problems understanding how to avoid quantifiers and / or metacharacters.
I want to make sure that the password string contains only one or more characters (maximum 32) from the following intervals:
"abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "012345678901234567890123456789" " !@ #%&/(){}[]=?+*^~-_.:,;"
The first three flights are quite easy, but I can not understand the last. Basically my script looks something like this:
var password = "user_input_password"; if (/^[ A-Za-z0-9!@ #$%...]{1,32}$/.test(password)) { document.write('OK'); } else { document.write('Not OK'); }
Any help or input is appreciated, thanks!
source share