1- When I ran this code:
let testStr = "PumpkinPenguin"; let testRegex = /P(engu|umpk)in/; console.log(testStr.match(testRegex));
the result was:
["Pumpkin", "umpk"] , and when I added the global search flag, it changed “umpk” into Penguin. Why is that?
2- Another question regarding the challenge:
It is asking me to do the following:
Fix the regex so that it checks for the names of
Eleanor Rooseveltin a case sensitive manner and it should make concessions for middle names.
And the solution to the challenge will check
Franklin D.Roosevelt for example. What if I don’t want this case to happen (i.e. how can I make a space obligatory between two names whether the middle name is there or not so that something like
Franklin D.Roosevelt or
FranklinRoosevelt is not checked and how can I make the middle name take a limit of only one letter and a dot without affect the checkability of the case where we don’t have a middle name so that
Franklin Roosevelt is checked and
Franklin D. Roosevelt is checked, but
Franklin Da. Roosevelt is not checked?
Challenge: Check For Mixed Grouping of Characters
Link to the challenge: