3 ms·
The only problem with regex is that people try to parse HTML with it. And in that sentence, neither 'regex' nor 'HTML' are the root of the problem. IMHO, igno
by ethbr0 4y ago
The only problem with regex is that people try to parse HTML with it.
And in that sentence, neither 'regex' nor 'HTML' are the root of the problem.
IMHO, ignorance should never be a valid feature request.
- berkes 4y agoAre you honestly implying that there are still people who, in all seriousness, use a REGEX to parse HTML? Every programmer I have met, however junior, knows or learns about Zalgo early on. It's like the "foobar" wrt regexps: common knowledge. True, knowing it's a bad idea won't hold people from doing it. I do it. I'll whip up some stupid `:%s/\<?p class="strong"?>/<strong>/g` occasionally in vim, knowing perfectly fine that this regexp won't be solid, but: works for this case. All the while knowing about Zalgo for years (decades?)
- dmitriid 4y ago> Are you honestly implying that there are still people who, in all seriousness, use a REGEX to parse HTML Subsets of it? Yes. See Google's lit-html as an example: https://github.com/lit/lit/blob/main/packages/lit-html/src/lit-html.ts https://github.com/lit/lit/blob/main/packages/lit-html/src/l...
- ethbr0 4y agoYes, but the specific problem is that it's not general knowledge exactly why you shouldn't attempt it. Ask a handful of developers and see how many mention Chomsky Type 3 grammar, or even regular grammar. And unless you scope an understanding of what regexes are to that, which is non-trivial, you get some bizarre feature requests, because people are attempting to use it inappropriately. They don't know what they don't know.