zlacker

[parent] [thread] 1 comments
1. umanwi+(OP)[view] [source] 2026-02-03 16:23:05
It also hinges on another word: parsing. There are things other than parsing that you might want to do. For example, if you want to count the number of `<hr>` tags in an HTML document, that doesn't require parsing it, and can indeed be done with regex.
replies(1): >>kstrau+3c
2. kstrau+3c[view] [source] 2026-02-03 17:11:10
>>umanwi+(OP)
No you can’t. You can have an unescaped <hr> inside a script tag, for example. The best you can do is a simple string search for “<hr>” and hope it’s returning what you think it might be returning. Regexps are not powerful enough to determine whether any particular instance of “<hr>” is actually an HTML tag.

Like, it’s not a matter of cleverness, either. You can’t code around it. It’s simply not possible.

[go to top]