Regular expressions password checker help to understand

Tell us what’s happening:
Describe your issue in detail here.
can someone help me to understand how we use positive and negative lookaheads to check the password as i know lookaheads used to check if something is followed by another something but i cant see this formula here ?

Your code so far

let sampleWord = "astronaut";
let pwRegex = /change/; // Change this line
let result = pwRegex.test(sampleWord);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Challenge: Positive and Negative Lookahead

Link to the challenge:

you got to do some ‘searching’ and ‘googling’ to get a better understanding of ‘regEx’

and about this, my ‘code’ passes for all but ‘one’ test cases!! you better look into ‘Hint’ section and ‘provided example’, it should be a good place to start!! good luck and happy learning :slight_smile:

if you’re interested, in what i have tried as a starting point for your quest, then feel free to have at it:

  • /\w(?=\w)(?=\D\d)/ this results in ‘2 fail test case’
  • /\w(?=\w)(?=1\d)/ this results in ‘1 fail test case’
  • /(?=\w{5})(?=\w*\d{2})/ this will result in 1 fail test case, but if you just a ‘character’ it will pass for all!! :grin:

once again, good luck :slight_smile: