Tell us what’s happening:
I am receiving the following error:
// running tests Your regex should match
“bana12”
Your regex should match
“abc123”
Your regex should match
“astr1on11aut”
// tests completed
Your code so far
let sampleWord = "astronaut";
let pwRegex = /^\D(?=\w{5,})(?=\d\d)/; // Change this line
let result = pwRegex.test(sampleWord);```js
let sampleWord = "astronaut";
let pwRegex = /^\D(?=\w{5,})(?=\d\d)/; // Change this line
let result = pwRegex.test(sampleWord);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
this is an issue I see often: lookaheads look forward, but they actually match a 0-dimentional part of the string
it means that both lookahead will check starting from same character, essentially you are saying that second and third characters of the string must be numbers
ieahleen, THANK YOU SOOOO MUCH… you have helped me sooo much with that last statement. I was able to solve this particular problem and better understand “lookahead”(s) overall.
I am very grateful… you are my Yoda (smile)… smart you are!