Javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching

I want to know why this warning has been given
"
Note
Parsing HTML with regular expressions should be avoided, but pattern matching an HTML string with regular expressions is completely fine. "

Does doing so create huge problems in the code?

Interesting question, I did a quick search and came across this post: https://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not

It seems to be due to the fact that regex by it’s very nature can only parse regular languages. HTML is considered non-regular, hence the need for something that can parse non-regular languages :slightly_smiling_face:

I did some further digging through that post, it seems like depending on the type of regex, it can in-fact parse non-regular languages as well. It might be then that the note that was provided was a product of a different time.

FreeCodeCamp came up in 2014 so the code here isnt that old or of a different type…so can i use regular exp to do stuff without generating random errors.

Thanks for those links.

careful with regex and parsing html, it can get stuck in infinite loops

you can see a bug with it also in the curriculum tests: