News for hackers. Stuff that matters.
Re:Regex Engine Internals as a Library by burntsushi on Wednesday July 05, 2023 @04:00PM (#36606229)
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.

Re:Regex Engine Internals as a Library by BoppreH on Wednesday July 05, 2023 @04:19PM (#36606499)
> 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.

Re:Regex Engine Internals as a Library by burntsushi on Wednesday July 05, 2023 @04:47PM (#36606856)
Yeah 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.

Re:Regex Engine Internals as a Library by nerdponx on Wednesday July 05, 2023 @07:46PM (#36608874)
One 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!