Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Their utility is overstated until the one time when you actually need/want it.

Last time I tried to figure out if there were existing tools to solve a problem like this, I came across Event Calculus: https://en.wikipedia.org/wiki/Event_calculus

I'm sure there's some interesting CS theory to be uncovered here.



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.


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


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!


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.




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

Search: