Regex looks like line noise until you can see it match. So here's a regex tester that highlights matches live, lists your capture groups, and runs entirely on the browser's built-in engine — no library.
🔎 Try it (type a pattern): https://dev48v.infy.uk/solve/day14-regex-tester.html
The engine is already in your browser
new RegExp(pattern, flags) + string.matchAll(re) gives you every match with its index and capture groups. The whole tool is a thin UI over that.
What it shows live
- Every match highlighted in the test text as you type
- Match count + each match's index
- Numbered AND named capture groups (
(?<year>\d{4})) - A friendly error (not a crash) when the pattern is invalid — wrap
new RegExpin try/catch - Flag toggles: g, i, m, s, u
Two gotchas worth knowing
- With the global flag, a zero-width match (like
a*) can loop forever — bumplastIndexwhen a match is empty. - Catastrophic backtracking (nested quantifiers like
(a+)+) can hang the engine. Keep patterns specific.
🔨 Full build (RegExp + matchAll → highlight → list groups → presets → error handling) on the page: https://dev48v.infy.uk/solve/day14-regex-tester.html
Part of SolveFromZero. 🌐 https://dev48v.infy.uk
Top comments (0)