Basically you’re finding the shortest route from “<h1” to the next “>”. Without the question mark, it would find the longest route to the next “>” which would return the whole variable.
Reading “Remember the wildcard . in a regular expression matches any character.”
I think the correct solution should keep the wildcard . so I tried with myRegex = /<.*?>/;
and pass the test
“Great is the confusion under the sky. The situation is excellent”
The most efficient way to match this is /<.*?>/ or /<.+?>/ although this will work but it will only match only opening tag <h1> and not </h1> accompany it with g to get all the matches.