Regex Match Highlighter — Visualize Your Pattern
Overview
When debugging a complex regex, seeing which text matched (and which did not) is more useful than a list of match strings. This tool wraps each match in a colored span directly in the test string view, cycling through six colors so overlapping patterns are distinguishable. Click any highlighted span to focus that match in the match list below.
How to Use This Tool
Enter your regex pattern and set flags. Paste the text you want to test. Colored highlights appear immediately over each match. The match list below shows the full match text, position (start to end), and any capture group values. Click a match to select it and highlight it with a focus ring.
Ready to get started? It's free, no registration required, and your files never leave your device.
PDF Tool →Frequently Asked Questions
Why does my global regex only match once?
Without the g flag, JavaScript's RegExp stops after the first match. Enable the g toggle to find all matches in the test string. The match count shown next to 'Test String' confirms how many were found.
What does the match position mean?
Position refers to the character index in the test string, starting from 0. A match at pos 10–14 means characters at index 10, 11, 12, and 13 were matched (end is exclusive, like JavaScript's slice() method).
Can I use lookahead and lookbehind assertions?
Yes. V8 (Chrome, Edge, Node.js) and SpiderMonkey (Firefox) both support positive and negative lookahead (?=...) and lookbehind (?<=...). Safari added lookbehind support in Safari 16.4. The tool uses the browser's native RegExp engine.