Hacker News new | past | comments | ask | show | jobs | submit login

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).




Many 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.


Some 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: