I would like to know if the \w+ or \w* part is needed in the challenge. Or the \D* part in the example.
So why is it? It is not possible to ignore it or why is it so important?
let sampleWord = "astronaut";
let pwRegex = /(?=\w{6,})(?=\w+\d{2})/; // Cambia esta línea
let result = pwRegex.test(sampleWord);
I searched on this Lookahead topic and I think I understand it a lot (obviously not perfectly), but I can’t figure out why it is necessary in this case.
because both lookaheads start looking at the same position, so putting in \w* you are saying that there can be any number of characters before the two consecutive digits