I need to validate the criteria in a password:
- Must contain at least one uppercase letter.
- At least one lowercase
- At least one number
- Size must be between 6 and 32 characters
- Can not have any special characters or spaces
- Must have all 3 types: uppercase, lowercase and numbers, no matter the order
I tried several ways, I took a look at the regex documentation (Elixir and Perl), but I locked it here:
Regex.run(~r/^[A-Z](?=.*)[a-z](?=.*)[^\W_]{5,30}$/,IO.gets"")
But this regex only allows the password starting with uppercase and does not allow numbers, if I add something like \d(?=.*)
or [0-9](?=.*)
nothing else works.
As an example in ES / JS would be: /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)[^\W_]{6,32}$/