I am looking for an efficient way to strip HTML comments from a string representation of HTML:
<div>
<!-- remove this -->
<ul>
<!-- and this -->
<li></li>
<li></li>
</ul>
</div>
I do not want to convert the string to actual nodes, the content is originally a string and the filesize is around 600mb.
Curious if anyone has had this problem before and found an efficient, and easily generalized solution.