3 ms·
Or write a parser! In most cases the parser will not be shorter (code) than the regex, but it will most certainly be simpler (cognitively; it's hard to underst
by cies 2y ago
Or write a parser!
In most cases the parser will not be shorter (code) than the regex, but it will most certainly be simpler (cognitively; it's hard to understand all that regexes do, they're close to magic) and more testable (you can test the parts of the parser, like the number parser or the string parser, individually), and often faster too.
- cies 2y agohttps://stackoverflow.com/questions/11905506/regular-expression-vs-string-parsing https://stackoverflow.com/questions/11905506/regular-express...