15 points seizethecheese 1 day ago 5 comments
seizethecheese 1 day ago | parent
Let's be honest, regex can be hard to understand even for technical people. (At least it's hard for me.)
So coworker built this to help anyone understand arbitrary regex commands.
AI disclosure: this was built using Agent Duel, a local coding agent arena system (https://github.com/bottomless/agent-duel). Promotion disclosure: our company is building agent duel. To test it and find bugs we are building passion projects through the system. I nonetheless thought HN would find this interesting.
ogogmad 46 minutes ago | parent
"|", which means "or"
".", which means "any symbol"
"?", which means "at most once",
"*", which means "however many times"
"+", which means "at least once"
Maybe encountering it next to PEG scrambles your brain.atoav 44 minutes ago | parent
The problem IMO is that a lot of the traditional teaching material starts with the complexity (and impressive possibilities) of regex, when the best way to start learning it is probably just thinking about it as an extension to simple text matching.
Getting to know regex fully is in fact complicated, getting know enough regex to filter/search/replace 90% of everything you will always need is not too complicated.
ogogmad 20 minutes ago | parent
.
|
?
\*
+
regex only has capture groups ()
and lazy variants of the core quantifiers "?", "*" and "+", called respectively: ??
*?
+?
The rest is just shorthands. So while I think it's a worthwhile suggestion not to show people the whole thing, I'm wondering if the whole thing is really that complicated anyway.monster_truck 1 hour ago | parent