3 ms·
Interesting that he claims that it's difficult to change a regular expression to cope with new requirements but easy to change a hand-coded loop. In my experie
by chwahoo 15y ago
Interesting that he claims that it's difficult to change a regular expression to cope with new requirements but easy to change a hand-coded loop.
In my experience, the opposite is true (up to the point when your grammar becomes non-regular).
- lukesandberg 15y agoMany regular expression implementations don't deal properly with unicode character classes and collation. So adding something like unicode identifiers to go may be impossible or impractical with regexs whereas with a loop you can rely on more standard collation support.
- fooyc 15y agoSome libs such as PCRE can match by character properties, for example \pL would match any unicode letter. Doing that in a loop seems to be much more difficult. And unless you work on utf-32 data, you have to handle variable-size encoding of characters.