3 ms·
> So any attempt at improving this mess is welcome in my book. Already done, I think. :) 2. Not a big problem if the responsible programmer employs named capt
by bmn__ 4y ago
> So any attempt at improving this mess is welcome in my book.
Already done, I think. :)
2. Not a big problem if the responsible programmer employs named captures and named subpatterns, and switches on extended mode and makes use of whitespace and comments. Like with any other programming environments, it's a matter of wanting to write readable code, and perhaps enforcing this through technical and social means.
3. I observe that Perl-style regex have become the de facto standard, in the sense that numerous programming languages in common use have adopted it, and preceding styles are marginalised to the point that any discussion about regex that does not mention the style makes the assumption of Perl-style.
The next points are actually implementation dependent. It is not fair to condemn regex as a whole just because some implementations fall short.
4. Perl has good debugging tools for regex.
5. This is easy to express in Perl.
6. Non-capturing grouping exists.
7. Named subpatterns exist, interpolation of variables containing regex values exists.
- oblio 4y agoPerl is a dying language. Your 4-5 "solutions" are non-solutions in practice for 99% of software developers out there. And regexps are by default written in the concise form. It's the standard problem of "opt-in" vs "opt-out". Opt-in, as a rule of thumb, has low adoption rates, for various reasons (maybe 20% if you get lucky). Opt-out is the inverse, it has adoption rates of 90%+, except for total, universally known disasters. Tools which are unsafe by default are bad. Yes, the craftsmen are bad, but the way we improve is by also improving our tools. It doesn't matter how much pointing at the idiots we do, practical regexps have been around since ~1975, that's almost 50 years. In industrial use they haven't gotten safer. That's bad.