Regular Expressions - Find Characters with Lazy Matching

Tell us what’s happening:
Describe your issue in detail here.

Hi guys, below is my reasoning for the solution but I’m not sure if I’m right or wrong so it’d be great to hear y’all fellow coders’ thoughts and feedbacks. Thanks
For this Regex: /<.*?>/
< = exact/literal match
. = match anything (i.e. ‘h’)

  • = repeat wildcard/match anything 0 or more times (i.e. 0 times gives which doesn’t exist, repeat 1x gives

    ? = lazy matching (i.e. shortest string between <> gives

Is my reasoning correct?

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15

Challenge: Regular Expressions - Find Characters with Lazy Matching

Link to the challenge:

If you just need to understand a regex pattern you can paste it into the tool below and examine its parts there to understand them.

Make sure you change the regex flavor option to ECMAScript first though

Edit: you did understand it correctly