Using the regex

Tell us what’s happening:
Describe your issue in detail here.
when I test my code it emphasizes to me that when I enter that number it must be returned but when I test in the console everything works but to again underline the same problem

  **Your code so far**

let sampleWord = "1a2bcde";
let tab = ["astronaut", "banan1", "banan12", "abc123", "12345", "8pass99", "1a2bcde", "astr1on11aut"];
var i;
let pwRegex;
let result;
for(i=0; i < tab.length; i++)
  pwRegex = (/\D/.test(tab[i]))? /(?=\w{5,})(?=\D*\d{2,})/ : /\D/; // Change this line
result = pwRegex.test(tab[i]);
/*pwRegex = (/\D/.test(sampleWord))? /(?=\w{5,})(?=\D*\d{2,})/ : /\D/; // Change this line
result = pwRegex.test(sampleWord);
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Challenge: Positive and Negative Lookahead

Link to the challenge:

your question and the code you posted don’t match again, please be clear on what code you are asking about

Also, the exercise asks greater than five characters :slight_smile: .

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