3 ms·
>you should be using regexps all the time Personally, I try to limit my usage as much as possible. Regexes are basically only useful for things I do in my term
by nv-vn 10y ago
>you should be using regexps all the time
Personally, I try to limit my usage as much as possible. Regexes are basically only useful for things I do in my terminal and occasionally verifying that data is well-formed. For practical parsing, it's almost always better (and runs faster) to use a more robust solution like parser combinators or lexer/parser generators. Even oftentimes for things that are seen as perfect regex use-cases (validating data or splitting strings), using a parsing solution will work better -- for example, you can't be sure that all the numbers in your data are small enough to not overflow the integers using regexes alone (or at least not without resorting to extremely long and unreadable regexes). Regexes are a tool that's easy to reach for, but a lot of the time it's a tool that will end up breaking on you eventually.
- zwischenzug 10y agoI use :s%/search/replace/g very very often (for example).
- rjeli 10y agofor those following along in ex, it should be :%s/foo/bar/g
- zwischenzug 10y agoOops :)