4 ms·
Nice to have this comparison in one place, but I think also serves as a good illustration of the limits of regex usefulness. It feels like this would just be be
by matt2000 11y ago
Nice to have this comparison in one place, but I think also serves as a good illustration of the limits of regex usefulness. It feels like this would just be better off implemented in the language of your choice instead of an impenetrable string of characters.
- treve 11y agoThis is partially because every single regex in the example is terribly written. Regexes _can_ look good and understandable with the x modifier and lots of spaces and comments. You wouldn't write a normal function in one line with no comments, why do it with regex?
- ethbro 11y agoObligatory "Conway's GoL in one line of APL" http://catpad.net/michael/apl/ http://catpad.net/michael/apl/
- thaumaturgy 11y agoThat can get ugly too. I have a function that takes in a (possibly malformed) URL and returns a key-value array of its parts ... seems straightforward, but it's about 300 lines, and this site includes some tests that I haven't bothered to concoct yet, so mine probably isn't even complete. URIs are one of those things that make you go, "Oh! That should be easy!", and then a week later you're walking around looking for puppies to kick.
- Retra 11y agoThere're some other options for regex syntax: https://github.com/VerbalExpressions/JSVerbalExpressions https://github.com/VerbalExpressions/JSVerbalExpressions