Skip to content

Instantly share code, notes, and snippets.

@acezalba
Last active March 1, 2020 06:30
Show Gist options
  • Save acezalba/eb4fbe9aeec2cd1a7ac1f26d78f0251c to your computer and use it in GitHub Desktop.
Save acezalba/eb4fbe9aeec2cd1a7ac1f26d78f0251c to your computer and use it in GitHub Desktop.
Regex Lazy Matching Template #fcc #js #regex
let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?>/; // Change this line
let result = text.match(myRegex);
// + is greedy
// ? is lazy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment