Specify Upper and Lower Number of Matches -- help

Tell us what’s happening:

I first tried the following regex /h{3,6}/;
It didn’t work, why?
It didn’t pass the last test of: “Ohhhhhhh no”

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

I think /h{3,6}/ will pass as long as it finds between 3 and 6 h’s which “Ohhhhhhh” does, it doesnt matter that it contains more h’s, your regex just says return true if there are between 3 and 6.

Try using Chrome. Your code is fine.

I am using Chrome, did not pass, bug maybe.

There are no bugs that I am aware of for this challenge. Can you post then entire code you are using for this challenge? I want to check for something.

You can also trying refresh the page (Ctrl + F5) and running the tests again.

let ohStr = “Ohhh no”;
let ohRegex = /h{3,6}/; // Change this line
let result = ohRegex.test(ohStr);

Tried again, didn’t work again.

That is because your latest code posted above does not include the space character and “no” after the h{3,6}. Your original code your posted had this, which is why I said the code you have should work.

Well, under “tell us what is happening” at the top of my post I mentioned the exact same code I wrote recently on this post.

I was going by the code written under the above title, which is the correct code. Your post had conflicting information which made it difficult for me to tell which was your actual code.

I tried explaining what was going wrong above, the upper limit won’t work the way you want if its associated with just one character

Is there any reason for that or just a JS quirk?