3 ms·
Regexes are a bit of a double-edged sword. I rarely use them in code - I often find it more productive (and maintainable) to simply type out the verbose code fo
by throwuxiytayq 5y ago
Regexes are a bit of a double-edged sword. I rarely use them in code - I often find it more productive (and maintainable) to simply type out the verbose code for doing the string transformations. This depends on how good you are at writing/interpreting regexes and on what text manipulation tools your programming language/stdlib gives you. I imagine a compiled regex can often outperform naively-written code, though.
On the other hand, regexes saved my skin a couple of times when I needed to search/extract/modify/format a large number of text files (or one extremely big one). I suck at command line, so I usually open the file/folder in vscode and use their search/replace function. It's super useful for these "one shot" text operations.