Guide
JSON or regex failing? Split “is it valid?” from “does it do what I meant?”
Both are punctuation-heavy. First make the syntax valid, then check the actual behavior.
Format JSON before hunting for the bug
Pretty-printing turns a wall of text into a visible structure. If an error points at line 20, also inspect line 19—the parser may only have realized the problem one token later.
A regex match is not automatically the right match
Highlight the exact span, inspect capture groups, and check flags. “It matched something” is only the beginning.
Preview replacements before replacing everything
One greedy pattern can eat much more text than expected. A preview turns a risky global replace into something you can inspect first.
Test long input if the regex will see outside data
Some patterns are fast on a short sample and painfully slow on adversarial input. Correctness and performance are separate checks.
Make the failing example smaller
Reduce a huge JSON document to one failing object. Reduce a long regex test to one string that should match and one that should not.
A small reproduction makes both the syntax problem and your intended behavior much easier to see.