The Parenthesis
Submarine.
Every ( is a dive. Every ) brings you up.
Repair six little sea messages, or type your own and watch its hidden depths unfold. No timer. No maths exam. Just a submarine with impeccable punctuation.
01 / The dive console
Ready to exploreTap a bracket to find its partner and inspect its depth.
The route treats all other characters as cargo. This is a parentheses explorer, not a full programming-language parser: brackets inside quoted strings count too.
Why does a regex need to recurse?
A flat pair is easy. A pair containing another pair containing another pair needs the same rule again, inside itself. Jon’s post spotted PHP’s (?1): “run capture group 1 again”. Here is the fixed expression actually used by this page:
~\A((?:[^()]++|\((?1)\))*)\z~u[^()]++ carries ordinary text. \( … \) wraps a matched pair. (?1) handles whatever is inside that pair. The anchors require the entire message to fit. The browser draws the route using a stack; the PHP server separately checks the recursive regex. Different machinery, same little ocean.