4 ms·
Regexes at the command line are usually about writing a quick throwaway pipeline that you tweak into working once in a specific case. It doesn't have to be a co
by maxbond 2y ago
Regexes at the command line are usually about writing a quick throwaway pipeline that you tweak into working once in a specific case. It doesn't have to be a correct or reliable implementation, it just has to get the job done correctly in this instance. Special cases you may have encountered but didn't can be ignored.
If you are doing sometime repeatedly, especially if it's automated, then yes, if possible you should write/adopt a real parser and add error handling and such.
ETA: A notable exception is file paths and similar. Regexes are a totally acceptable way to parse those (modulo issues like escaping user input).