Tell us what’s happening:
I’ve recently started with regular expressions and came across this hint in the description in one of the assignments.
“Parsing HTML with regular expressions should be avoided, but pattern matching an HTML string with regular expressions is completely fine.”
I understand what this means literally but as someone who has only been coding for about 2 weeks, I was hoping someone more knowledgable might be able to explain what this hint means as a guideline.
Is it just saying that although we are learning how to parse strings we should not do it? Or that some of the methods are better than others?
Anyway, some insight into the general practice of what is the best way to apply these lessons for a smooth and logical approach to coding would be amazing.
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_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36.
Challenge: Find Characters with Lazy Matching
Link to the challenge: