Created
October 10, 2019 11:48
-
-
Save nickihastings/2afd147f407b8dd9b77e6d2bc7bbea9f to your computer and use it in GitHub Desktop.
Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long and have two consecutive digits.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
/(?=\w{5,})(?=\D\w*\d{2})/
this'll work