Regular Expressions - Positive and Negative Lookahead

Tell us what’s happening:
Describe your issue in detail here.
I have finished the challenge but I am still confuse a bit so could someone explains me what’s happening behind the scene???

I meant the code explanation of this regex:

 /(?=\w{5,})(?=\D+\d{2})/

Your code so far

let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(?=\D+\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36

Challenge: Regular Expressions - Positive and Negative Lookahead

Link to the challenge:

what do you understand of this code? what are your doubts?

if you want a breakdown you can use a regex tool like https://regex101.com/ (set ECMAScript on the left)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.