Confusion about Find Characters with Lazy Matching

Tell us what’s happening:
Describe your issue in detail here.
I am confused about the . and * in this code, I know about their function, I just do not understand what do they do in this code. Also, I have deleted the . , *and it returned “null”.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Find Characters with Lazy Matching

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching

The .is any character, .+ is one or more of any character

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.