RegEx Tester & Builder
Write and test regular expressions with live match highlighting and capture groups.
How it works
Regular expressions are notoriously easy to get subtly wrong. This tool runs your pattern against a test string as you type, highlights every match inline, and lists each match's index and capture groups so you can see exactly what your regex is doing.
- Type or paste a regular expression pattern and its flags (g, i, m, s, u, y).
- Paste the text you want to test it against.
- Matches are highlighted inline in real time as you edit either field.
- Scroll the match details table to inspect each match's position and captured groups.
Common use cases
- Building and debugging validation patterns (emails, phone numbers, slugs) before dropping them into code.
- Understanding why a regex from Stack Overflow or an LLM isn't matching what you expect.
- Extracting structured data from log lines or text using capture groups.
- Teaching or learning regex syntax with immediate visual feedback.
FAQ
- Which regex flavor does this use?
- JavaScript's native RegExp engine (ECMAScript). Patterns behave the same way they would in Node.js or client-side JavaScript, but may differ slightly from PCRE, Python's re, or other engines.
- Why is the 'g' flag always applied?
- Multiple matches are found using matchAll(), which requires the global flag. It's added automatically if you don't include it, so every match shows up rather than just the first one.
- Is there a limit on match count?
- Matching stops after 5,000 zero-length matches to avoid the tab freezing on a pathological pattern that matches an empty string repeatedly.