Confused on Specify Upper and Lower Number of Matches

Confused on Specify Upper and Lower Number of Matches
0.0 0

#1

Tell us what’s happening:

I’m not sure why my code isn’t working— I THINK I’m asking for a pattern that starts with an “o”, then has anywhere from 3-6 "h"s, then a space, then the word “no”.

So far, this DOES match “Ohhh no” and “Ohhhhh no” but not “Ohhhh no” or “Ohhhhhh no”.
Your code so far


let ohStr = "Ohhh no";
let ohRegex = /oh{3,6}\sno/gi; // Change this line
let result = ohRegex.test(ohStr);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 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


#2

Your regex is correct comrade, just remove the g flag and try again.
/oh{3,6}\sno/i
Happy coding.