Added new test cases and corrected the solution for positive and negative lookahead for ensuring that strings beginning with numbers are not accepted (#37485)
* Added new test case '8pass99' for positive and negative lookahead * Changed the pwRegex to reflect the new solution * Updated the pwRegex to reflect the latest solution as on forum * Added another test case to catch "/^(?=\w{6,})(?=\D*\d{2})/" solutionpull/37750/head^2
parent
deb24f77b6
commit
a987245e18
|
@ -58,6 +58,12 @@ tests:
|
||||||
testString: assert(!pwRegex.test("123"));
|
testString: assert(!pwRegex.test("123"));
|
||||||
- text: Your regex should not match <code>"1234"</code>
|
- text: Your regex should not match <code>"1234"</code>
|
||||||
testString: assert(!pwRegex.test("1234"));
|
testString: assert(!pwRegex.test("1234"));
|
||||||
|
- text: Your regex should not match <code>"8pass99"</code>
|
||||||
|
testString: assert(!pwRegex.test("8pass99"));
|
||||||
|
- text: Your regex should not match <code>"12abcde"</code>
|
||||||
|
testString: assert(!pwRegex.test("12abcde"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -85,7 +91,7 @@ let result = pwRegex.test(sampleWord);
|
||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var pwRegex = /(?=\w{6})(?=\D*\d{2})/;
|
var pwRegex = /^(?=\w{6})(?=\D+\d{2})/;
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in New Issue