Use lookaheads in the pwRegex
to match passwords that are greater than 5 characters long, and have two consecutive digits.
Solution:
let sampleWord = “astronaut”;
let pwRegex = /(?=\w{5,})(?=\w+\d{2})(?=[a-z])/i;
let result = pwRegex.test(sampleWord);