Help with Javascript: check for mixing grouping of characters

Tell us what’s happening:
Please why is my code not working?
I keep getting this errors:
Your regex " myRegex" should return “true” for the string “Franklin D. Roosevelt”
Your result should return “true.”

   **Your code so far**

let myString = "Eleanor Roosevelt";
let myRegex = /Ele(an)or | Fr(an)klin.*Roosevelt/; // Change this line
myRegex.test(myString);
// Change this line
// After passing the challenge experiment with myString and see how the grouping works
   **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15.

Challenge: Check For Mixed Grouping of Characters

Link to the challenge:

Hi @shagariboy ,

There is a space before Franklin in your regex.

oh wee!! I works.
I still don’t get why the “space” made the difference.

It checks for the space before ‘Franklin’ in myString which doesn’t exist and hence returns false.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.