Mixed Grouping of Characters

i really have no idea whay use .* for concession for middle names
in my head its either with or without middle name

Your code so far


let myString = "Eleanor Roosevelt";
let myRegex = /(Franklin|Eleanor)(\s|\sD.\s)Roosevelt/g; // Change this line
let result = myRegex.test(myString); // Change this line
// After passing the challenge experiment with myString and see how the grouping works
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36

Challenge: Check For Mixed Grouping of Characters

Link to the challenge:

Hello there, .* matches anything that comes between the mixed grouping and the last name. This is quite useful when you don’t know whether there is something else (like a middle name) you should consider, don’t you think?

EDIT: it works when used like this: *.*

even with white space?

* checks whether there is something. If there is nothing it matches nothing. Yes also works with spaces. + does not work with spaces.

okay, thanks! I got confused with the instructions

1 Like