Answer the question
In order to leave comments, you need to log in
How to prevent spaces in a regular expression?
Hello.
In general, you need to test a string with a regular expression for:
1. Length 6-16
2. At least 1 uppercase character
2. At least 1 lowercase character
3. At least 1 digit
4. Optional special characters.
this is what I came up with:
/(?=^.{8,16}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question