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})/" solution
This commit is contained in:
@ -58,6 +58,12 @@ tests:
|
||||
testString: assert(!pwRegex.test("123"));
|
||||
- text: Your regex should not match <code>"1234"</code>
|
||||
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
|
||||
var pwRegex = /(?=\w{6})(?=\D*\d{2})/;
|
||||
var pwRegex = /^(?=\w{6})(?=\D+\d{2})/;
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user