let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?>/;
let result = text.match(myRegex);
I am struggling to understand the myRegex part of the code. I know those symbols one by one: . - wildcard; *- match character; ?- lazy matching
How comes that they give a result <h1>?
Can sb explain it pls?
I like this regex tester because it provides a detailed explanation on the upper right side of the screen. So, if you plug in your test string and your regex (without the //), hopefully you’ll be able to understand why the h1 element was selected based on this tool’s explanation.
If you’d like to dig into regex a little deeper, the Full Stack Developer curriculum (JavaScript > RegEx) has great coverage in the lectures.