Tell us what’s happening:
The upper and lower limits are specified in code. But I see that it also matches if a character appears more times than upper limit.
.
Like {3,6} matches all characters appearing 3 or more times consecutively. But it also matches characters appearing more that 6 times.
If that’s how it was supposed to be, then whats the meaning of setting upper limit. I don’t find any use of it.
Your code so far
let ohStr = "Ohh no";
let ohRegex = /Oh{3,6}\sno/; // Change this line
let result = ohRegex.test(ohStr);
let typo = ohStr.match(ohRegex);
console.log(result);
console.log(typo);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches