4 ms·
I'm curious if this does concretely improve regular expressions or not for generic programmers. Overall, to me it seems the classic minor-but-not-radical improv
by pizza234 4y ago
I'm curious if this does concretely improve regular expressions or not for generic programmers. Overall, to me it seems the classic minor-but-not-radical improvement.
The major difference I see is that this is a sort of `/x` modified regex with better readability. This is a significant improvement - the big problem with `/x` is that one then needs to escape/encode whitespace, which typically offsets the improvement.
The other significant change is variables, however, when one reaches a certain complexity, IMO they should not use regexes anymore.
The other differences (based on the home page presentation) are cosmetic changes of the same semantics.
The fundamental assumption is that the main problem of regexes is about syntax rather than semantics. It's true the regexes are somewhat ugly and hard to remember, but, personally, I don't think that's the main problem. It would have probably been nice if regex started with this syntax, but integrating them in a new project is a difficult decision.
- ethbr0 4y agoThe 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.
- bmn__ 4y ago> Overall, to me it seems the classic minor-but-not-radical improvement. As a user of Perl, PCRE, JS xregexp, Python regex, Raku grammars, I concur with your opinion. There are a few other top-level comments that also don't see the point. The documentation is lacking a section about the rationale.