Re:You Should Learn Regex
by cies on Wednesday October 11, 2017 @08:28AM
(#15449170)
A very extensive article, and it shows how powerful RXes are.
It makes a point, in "8.3 - For Problems That Don't Require Regex" that RXes should not be overused when a simpler solution exists.
But there are also problems that are better solved without RXes, but with a "parser" instead. The article mentions parsers, fails to mention that self-made parsers also provide solutions in the same problem space as RXes. Some communities (like the Haskell community) prefer parsers as they allow to be inspected, tested and typed. Parsers provide a more robust and hackable solution, that is possibly faster than the equivalent RX.
Here a short tutorial for a popular parser library in Haskell, to get an idea of what it's like:
It makes a point, in "8.3 - For Problems That Don't Require Regex" that RXes should not be overused when a simpler solution exists.
But there are also problems that are better solved without RXes, but with a "parser" instead. The article mentions parsers, fails to mention that self-made parsers also provide solutions in the same problem space as RXes. Some communities (like the Haskell community) prefer parsers as they allow to be inspected, tested and typed. Parsers provide a more robust and hackable solution, that is possibly faster than the equivalent RX.
Here a short tutorial for a popular parser library in Haskell, to get an idea of what it's like:
http://akashagrawal.me/beginners-guide-to-megaparsec