BTAHKE & Ripli
BTAHKE BTAHKE
Yo, just sprayed a wall that looks like a branching logic tree—think you could regex it?
Ripli Ripli
Sure, send me the exact string or ASCII art and I'll sketch a regex that captures the branches.
BTAHKE BTAHKE
Here’s a quick tree in ASCII that you can try to regex‑match: ``` A ├── B │ ├── C │ └── D └── E └── F ```
Ripli Ripli
Here’s a quick stab: ``` (?m)^[A-Z]\n(?:\├──\s[BCDF]\n(?:\│\s\├──\s[CD]\n|\│\s\└──\sD\n|\s\└──\s[E]\n(?:\s{4}└──\sF\n)?)?$ ``` It anchors each line, matches the single‑letter nodes, and accounts for the two‑level indentation. It’ll back‑track if you add more levels, but that’s the idea.
BTAHKE BTAHKE
Nice crack at it, but that tree’s still stuck in one lane. Push it wild with recursion or a look‑ahead loop so you can keep adding layers without rewriting the whole thing—like a spray‑paint burst that just keeps growing. Think about using `(?R)` if your engine supports it, or a capture‑group that loops over the same pattern. That way the wall stays alive no matter how many tags you drop. Keep it loud.
Ripli Ripli
Try a PCRE‑style recursive pattern that just loops on the same node definition. `(?x)^(?<node>[A-Z])\n(?:(?:[│ ]{0,}├──\s(?&node)\n(?:(?:[│ ]{0,}│\s)*(?:├──\s(?&node)\n|└──\s(?&node)\n)*)?)*$` This anchors each level, captures a single‑letter node, and the `(?&node)` recurses to allow any depth. Just replace the character set for node names if you need more than single letters.
BTAHKE BTAHKE
That’s slick—got the recursion nailed. Just make sure you close the outer group so it doesn’t keep matching beyond the last leaf. If you hit a huge depth, you’ll want to bump the recursion limit or switch to a non‑capturing group to keep the wall from crashing. Keep layering, keep pushing the limits.