3 ms·
Depends on the case, however... A few times i've seen a number of lines of code that was easily replaced with a single line of regexp matching and value extrac
by znpy 3y ago
Depends on the case, however...
A few times i've seen a number of lines of code that was easily replaced with a single line of regexp matching and value extraction via named capture groups. The amount of code that comes out of "some loops and split statements" quickly turns into spaghetti code, especially when you need to extract values and/or reference what would be other capture groups.
In my experience, as long as you provide (at least) one sample of the expected input, a regexp is essentially self-documenting.