4 ms·
Oh it's definitely overstated by suggesting it should live alongside a general purpose regex engine. :-) I have no doubt that its utility can be great in niche
by burntsushi 3y ago
Oh it's definitely overstated by suggesting it should live alongside a general purpose regex engine. :-)
I have no doubt that its utility can be great in niche use cases. I've never come across one in my decades of programming that I know of, but I'm sure they exist.
- BoppreH 3y ago> I've never come across one in my decades of programming that I know of, but I'm sure they exist. The login attempt example was convoluted, so here are more common scenarios: - Grouping a list into pairs by matching /../ - Finding or collapsing repeated sequences with /(.)\1+/ - Parsing tag+value binary formats. - Searching structured logs. - DSL's for unit tests. Are there better ways to do each of those? Yes, but either because someone implemented those specific functions, or it's a much longer solution. Though I'm not recommending list-regexes for production code anytime soon. Prototypes and code golfing, sure, but not until the community understands it better.
- burntsushi 3y agoYeah I just wouldn't make use of regexes with arbitrary alphabets for any of those tasks personally. Doesn't really seem like a win to me. But like I said, someone should go build it.
- nerdponx 3y agoOne of the uses I had was for identifying particular subsequences of events in a long sequence. I actually at one point considered translating the sequence of events into a string of distinct Unicode code points, so I could define and match patterns as regular expressions!