Problems with a regex exercise

Hi campers,

I am trying to solve this exercise: link

I have done this code and it works in my machine:


let ohStr = "Ohhhhhhh no";  // change this to the different test cases 
let ohRegex = /Oh{3,6}\s/;
let result = ohRegex.test(ohStr);
console.log(result); // it returns false, which is the expected result

However, this does not work on FCC’s test cases.

Did I miss something? Why the results on my machine are different?

Thanks in advance.

Oh, I found it. Just putting the “no”.

let ohRegex = /Oh{3,6}\sno/;

Sorry for asking.

1 Like