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

The joke is not that you shouldn't use regular expressions but that you can't use regular expressions


An xml based data format is by definition a subset of all valid xml. In particular it may be a regular subset.


I swapped out a "proper" parser for a regex parser for one particular thing we have at work that was too slow with the original parser. The format it is parsing is very simple, one top level tag, no nested keys, no comments, no attributes, or any other of the weird things you can do in XML. We needed to get the value of one particular tag in a potentially huge file. As far as I can tell this format has been unchanged for the past 25 years ... It took me 10 minutes to write the regex parser, and it sped up the execution by 10-100x. If the format changes unannounced tomorrow and it breaks this, we'll deal with it - until then, YAGNI


That is what the joke is.

That is often not what is meant when the joke is referenced.


Is it really? Maybe I'm blessed with innocence, but I've never been tempted to read it as anything but a humorous commentary on formal language theory.




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

Search: