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

A widely quoted aphorism, originally from a USENET post: "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." —Jamie Zawinski,

This as a re-purposed quote, originally referencing sed or awk, and numerous people since have substituted in XML.



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


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




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: