2 ms·
They are totally different solutions. A regex is just a fast, usually integrated into the language, universally understood way to do some simple parsing. Parse
by rocqua 4y ago
They are totally different solutions.
A regex is just a fast, usually integrated into the language, universally understood way to do some simple parsing. Parser combinators are an amazing specialized tool for building parsers, but one that is generally harder to integrate into a code-base (outside of e.g. Haskell), requires lesser known libraries, and is a paradigm that people need time to get used to.
It's like saying people shouldn't use a mitre-box [1] and instead use a full fledged circular mitre-saw [2]. Yes the second tool is much more versatile, powerful and useful. But it requires much more setup, skill and investment to actually use.
[1] https://en.wikipedia.org/wiki/Mitre_box https://en.wikipedia.org/wiki/Mitre_box
[2] https://www.toolstation.com/power-tools/mitre-saws/c317 https://www.toolstation.com/power-tools/mitre-saws/c317