Regex visualized as 3D marble run

(regexmarblerun.com)

15 points | by seizethecheese 1 day ago

3 comments

  • monster_truck 1 hour ago
    This is actually pretty satisfying, I wish it had sound. Maybe a dramatic follow cam for the balls
  • seizethecheese 1 day ago
    My coworker used to teach non-technical people how to code. Students always found regex hard to understand.

    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.

    • atoav 45 minutes ago
      I am mostly an autodidact and learned bits regex on the fly when I needed it and I was always baffled why people have auch a hard time with it.

      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 22 minutes ago
        Autodidact here. Beyond just the five core quantifiers

          .
          |
          ?
          \*
          +
        
        regex only has capture groups

          ()
        
        and lazy variants of the core quantifiers "?", "*" and "+", which are respectively called:

          ??
          *?
          +?
        
        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.
    • ogogmad 47 minutes ago
      Really cool. Do you teach people the mechanics, like what the app shows? I wonder if that actually makes it harder. I'm wondering about where the hard bits are, given that it all boils down to just:

        "|", 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.
  • deakmisra 42 minutes ago
    [flagged]