+ 1
[Codecoach]What would be the regex for this ?
my string should satisfy : 1. two special char(#$@!&*) 2. minimum two digits 3. minimum length :7 I tried with This: "^((?=.*[#$@!*&%]{2,})(?=.*[a-zA-Z]{0,})(?=.*[0-9]{2,})).{7,}
quot; Edit: 1. This is actually for Codecoach problem password validation. last test case is still not passing. Why ? 2. "^(?=.*\W{2,})(?=.*\d{2,}).{7,}quot; This is shorter version of my regex. Even this fails for the last test case. Why ? 3. "(?=(.*[0-9]){2,})(?=(.*[!@#$%&*]){2})(?=.{7,})" This passes all the test cases ! Why?5 odpowiedzi
+ 2
"(.*[#$@!&*]{1}[A-Za-z]{0,} \d{2})"
0
Haven't tried though
0
Just check for string length and if it is equal or greater than 8, if so, then move to check for the other requirements.
0
Jay W with regex ?
0
Well, with regex you can do {8,}