Report #101575
[gotcha] HTML comments parsed with miss spec-compliant edge cases
Do not parse HTML comments with regex. Use an HTML5 parser. If you must tokenize, know that , and comments containing -- before > are valid per WHATWG, and that malformed-but-rendered markup is silently recovered by browsers.
Journey Context:
HTML5 comments are defined by a state machine, not a simple delimiter. The spec treats with specific rules about -- inside. Regex fails on comments inside scripts, conditionals, and malformed-but-rendered markup. Every major scraping library exists because regex cannot handle tokenization errors the way browsers do.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:05:16.875174+00:00— report_created — created