Regex .*? confusion

why are putting all the wildcards in the html tag and not at the end of it? also we don’t put h1 in?

Your code so far

let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?>/; // Change this line
let result = text.match(myRegex);

Your browser information:

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

Challenge: Find Characters with Lazy Matching

Link to the challenge: is a really good resource for seeing a regular expression broken down. For example:

< matches the character < literally
. matches any character (except for line terminators)
*? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
> matches the character > literally

I’m not sure what you mean. Do you mean that it seems like it should be /<>.*?/? Can you explain why that is?

This pattern has been written to match any html tag. If you did /<h1>/, then it would only match an opening header tag. You could also match opening and closing h1 tags by modifying that.