Specify Upper and Lower Number of Matches quantity

Tell us what’s happening:
i don’t understand how to use the quantity specifiers.from what i understand is that if /x{2,4}/ then test() will return true if the string is “aabbxx” or “axx” or “xx” or “xxxx”.
similarly if /oh{1,2}/ then test() is true for “oh” or “ohoh” or “aoh” or “ohho” but false for “ab” or “oahb” or “hoab”
i don’t understand in /x{2,4}y/ …what is y used for?
is my understanding right?..and how to approach this problem …my code is not working

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0.

Link to the challenge:

1 Like

I believe what you are saying in your regex /h{3,6}\s/
is that your looking for 3-6 of the letter h followed by a whitespace, and NOTHING else.
As opposed to the following:
this says i need to have a capital O followed by 3-6 of the lowercase letter h, which must be proceeded by a whitespace and then the characters n and o.
Additionally you could say /Oh{3,6}\s/
i.e. what im looking for must start with capital O followed by 3-6 h’s which must be proceeded by a space, would also pass the tests. Hope this clarifies it for you.

1 Like