2 ms·
While regexps can look intimidating try this: write something that does a regexp using just "normal" language features. Greenspun's law applies equally here; an
by gaius 15y ago
While regexps can look intimidating try this: write something that does a regexp using just "normal" language features. Greenspun's law applies equally here; any sufficiently complex parser will include a DSL for regular expressions...
- Retric 15y agoI think the root issue is deeper than that; regexps can't handle tree data structures of undefined depth. So while you can often get the common cases to work just fine, some of the edge case are often literally impossible to solve with regexps. PS: Parsing is one of those cases where you need to have the program do the types of things people are used to the source code doing. AKA, simply nesting if statements does not get you to a solution, which often leads to people tossing out lot's of buggy code. Creating a DSL (or Yet another LISP) can be really useful, but regexps is a dead end for a wide range of problems.