Regular Expressions - Check For Mixed Grouping of Characters

Tell us what’s happening:

  • Passed:Your regex myRegex should return true for the string Franklin D. Roosevelt

  • Failed:Your regex myRegex should return true for the string Eleanor Roosevelt

  • Passed:Your regex myRegex should return false for the string Franklin Rosevelt

  • Passed:Your regex myRegex should return false for the string Frank Roosevelt

  • Passed:Your regex myRegex should return false for the string FranklinRoosevelt

  • Passed:Your regex myRegex should return false for the string EleanorRoosevelt

  • Passed:You should use .test() to test the regex.

  • Failed:Your result should return true.

Why am i failing these two points i dont get it

Your code so far

let myString = "Eleanor Roosevelt";
let myRegex = /(Eleanor|Franklin) (.*) 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Challenge Information:

Regular Expressions - Check For Mixed Grouping of Characters

try console.log(result), you will see it says false. There is a small thing you are not considering in making this work.

1 Like

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