Regular Expressions - Check For Mixed Grouping of Characters

Tell us what’s happening:

Why my code is not showing true for Eleanor Roosevelt ? Does anyone have any idea ? It does show true for Franklin D. Roosevelt.

Your code so far

let myString = "Eleanor Roosevelt";
let myRegex = /(Franklin|Eleanor) ([A-Z].)* Roosevelt/; // Change this line
let result = 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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36

Challenge Information:

Regular Expressions - Check For Mixed Grouping of Characters

Take a closer look at the regex, in the (Franklin|Eleanor) ([A-Z].)* Roosevelt there is:

  • (Franklin|Eleanor)
  • space
  • ([A-Z].)*
  • space
  • Roosevelt

Okay I removed the space but it didn’t work

Do you mean that with one space removed Eleanor Roosevelt still doesn’t match the regex?

2 Likes

Yeah it matches now. Thanks a ton. :smiley:

1 Like

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