Well, I managed to complete the task. I don’t fully understand it though. I would appreciate it if anyone could help me out by pointing me to a more detailed page. furthermore, is there any good JS book for beginners?
thanks a lot
Your code so far
let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?[a-z0-9]*>/g; // Change this line
let result = text.match(myRegex);
console.log(result)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
.*? → any symbol (.) zero or more times (*) with as little as possible (?)
[a-z0-9]* → any lowercase letter followed by any digit zero or more times
> → “>”
It’s a good idea to look at the reference as your RegEx could be optimized in several ways… as in, you literally had to do nothing but add the “?” to the original code to pass.