Hello. Just checking something.
FCC solution:
let sampleWord = “aaa123”;
var pwRegex = /^\D(?=\w{5})(?=\w*\d{2})/;
let result = pwRegex.test(sampleWord);
Does (?=\w{5}) mean that the password is limited 5 characters? Or is it simply checking that the password has 5 characters? In my solution I wrote {5,} instead of {5} so that it would be 5 or greater.
Actually, the challenge asked us to have a password “greater than 5 characters long”, so in both cases shouldn’t it be at least {6,}?
Also, the positioning of ^D seemed to change the outcome too. When I tested the FCC solution, a password of aaa12 was false. However, my solution was:
/(?=\w{5})(?=^\D\w*\d{2})/
So that ^\D was in the second look-ahead. This meant that a password with 5 characters (aaa12) was true., which wouldn’t be what the challenge was asking for. It still passed but that’s because it wasn’t included in the test criteria.
Sorry if this is all trivial or poorly explained, but if anyone could clear this up for me it’d be greatly appreciated.