Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long and have two consecutive digits.
let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(?=\w+\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);
// Your regex should use two positive lookaheads.
// Your regex should not match "astronaut"
// Your regex should not match "airplanes"
// Your regex should not match "banan1"
// Your regex should match "bana12"
// Your regex should match "abc123"
// Your regex should not match "123"
// Your regex should not match "1234"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.