Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Yes 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.


Perl 6 Grammars maybe?



Rather structural matchers.

Like match in functional langs or lisp matchers https://www.cliki.net/pattern%20matching Unification is so much better than regex hacks.


Raku/Perl6 grammars are quite nice (particularly if the have improved support for raw strings).


Still, 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.


True regular expressions (that get compiled to DFAs) are faster if you don't need the funky PCRE features, and you usually don't.


Is there any popular language out there that implements DFA or Thompson NFA regexps (beside awk)?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: