I’m at a bit of a loss on this one. The first 2 tests “Your regex should match…” keep failing however they return true in the console when I console log the result. It’s even more baffling given I am passing the final test “Your result should return true”. My initial thought was I was misspelling the names but that doesn’t seem to be the case. Has anyone experienced the same on this one?
let myString = "Eleanor Roosevelt";
// let myString = "Franklin D. Roosevelt";
let myRegex = /(Franklin|Eleanor).*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
Welcome to the forum @3ndymi0n
For future reference, be sure to add a link to the challenge with which you are struggling. Something like the following:
It will make it far easier for us to help you
As far as the challenge is concerned, it seems the test has issues with the global flag. If you remove it, the challenge should clear.
-let myRegex = /(Franklin|Eleanor).*Roosevelt/g;
+let myRegex = /(Franklin|Eleanor).*Roosevelt/;
I don’t know if this is intentional though, and it might require an update to the text of the challenge @RandellDawson (sorry to bother you).
It is a tad confusing, especially considering that the snippet describing the challenge does use the flag in question.
let testStr = "Pumpkin";
let testRegex = /P(engu|umpk)in/g; // remove the global flag from the snippet???
@borntofrappe Would you mind creating a GitHub issue with your suggestion(s) here. Then others can look at your suggestion and conclude on the best approach to fix the challenge.
Thank you for the suggestion, I’ll file an issue promptly.
Thanks heaps @borntofrappe. Your advice was spot on.