I am trying to match a password with "no spaces or no symbols" in javascript regex.
What I tried was: /[^a-zA-Z0-9]|(.*\s)/g
I'm not sure if this is a correct regex. Can someone help please?
I am trying to match a password with "no spaces or no symbols" in javascript regex.
What I tried was: /[^a-zA-Z0-9]|(.*\s)/g
I'm not sure if this is a correct regex. Can someone help please?
https://regex101.com/r/XKJcTs/1
^[^\W_]+$
Reject everything that is not alphanumeric and the underscore. Require at least once. This will allow passwords with one character. You can change the +
to {min, max}
or to {min,}
for no upper limit.
^[^\W_]{3,48}$
https://regex101.com/r/XKJcTs/2
Taken from this answer https://stackoverflow.com/a/23817519/2604378