Regular Expressions: Specify Upper and Lower Number of Matches

Hi Campers,

I’m rattling through Regular expressions, but can’t quite work out why I’m failing the final test here:

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches

My code so far:

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

Any pointers most welcome.

Thanks in advance.

Gerald

1 Like

You are matching on hs, but the instructions want you to be dealing specifically with the words “Oh no” with 3-6 hs.

1 Like

Penny’s dropped! Many thx.

I’m actually still confused…

1 Like

You specifically need a regex for “Oh no” with three to six hs. If all that is in your regex pattern is h{3, 6} then you will match any three to six hs.