Positive and Negative Lookahead greater than 5 characters long

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);

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