3 ms·
PCRE patterns are inherently unmaintainable; they're not (naturally) compositional or testable. They also cause unpleasant surprises due to accidental Turing co
by lmm 5y ago
PCRE patterns are inherently unmaintainable; they're not (naturally) compositional or testable. They also cause unpleasant surprises due to accidental Turing completeness (indeed that's one of the more common causes of production outages that I've seen). IMO it's past time for newer languages to offer better alternatives, e.g. really good parser combinator support in the standard library.
- fho 5y agoYes and no ... I love Haskell's Parsec derived family of libraries (especially Attoparsec for fast and Megaparsec for detailed parsing). But sometimes you just need to throw something together fast. Eg search and replace in Vim uses regexps.
- cutler 5y agoPerl 6 Grammars maybe?
- yesbut 5y agoLink for anyone interested: https://docs.raku.org/language/grammar_tutorial https://docs.raku.org/language/grammar_tutorial
- rurban 5y agoRather structural matchers. Like match in functional langs or lisp matchers https://www.cliki.net/pattern%20matching https://www.cliki.net/pattern%20matching Unification is so much better than regex hacks.
- ggrrhh_ta 5y agoRaku/Perl6 grammars are quite nice (particularly if the have improved support for raw strings).
- deleted 5y ago[deleted]
- ivanhoe 5y agoStill, when you have a well-defined input and you can treat data as a flat string (no hierarchy), PCRE is probably the best choice you have - and certainly the fastest one.