Yep. The reason you can't parse HTML correctly with regex is quite simple: You need to execute arbitrary Javascript, due to the document.write() API. I have written a regex for HTML tags and (most) entities, though. (Although arbitrary entities are yet another can of worms)
View all comments
Show parent comment
1
u/mateon1 Sep 09 '17
Yep. The reason you can't parse HTML correctly with regex is quite simple:
You need to execute arbitrary Javascript, due to the document.write() API.
I have written a regex for HTML tags and (most) entities, though. (Although arbitrary entities are yet another can of worms)