Accounting for spaces in Regular Expressions: Check For Mixed Grouping of Characters

Hello all,

How is it that the space between the first and last name – and optional middle name – in this challenge is accounted for without using the \s element in the regex?

This is from the lesson Regular Expressions: Check For Mixed Grouping of Characters.

let myString = "Eleanor Roosevelt";
let myRegex = /(Franklin|Eleanor).*Roosevelt/;
let result = myRegex.test(myString);

The period gets any single character, and the asterisk grabs any number of matches, so the net effect of .* is to allow almost anything between the first match (Franklin|Eleanor) and the second match, Roosevelt.

You can check out the behavior here: https://www.regexpal.com/

The Regex is far from great as “Eleanor 1237a90dsfasj Roosevelt” generates a match.