Live Match Highlighting
Matches are highlighted in your test text as you type, with alternating colours so neighbouring matches are easy to tell apart.
Test and debug regular expressions with live match highlighting. See every match, capture group and named group as you type, and preview replacements before you use them in code.
Uses JavaScript regular expression syntax, run safely in your browser with a time limit to catch runaway patterns.
A regular expression (regex) is a compact pattern for finding and extracting text. A regex tester lets you try a pattern against sample text and instantly see what it matches, so you can fix it before it goes into your code.
This tester uses the JavaScript regex engine — the same one used by browsers and Node.js — and highlights every match along with its capture groups.
Matches are highlighted in your test text as you type, with alternating colours so neighbouring matches are easy to tell apart.
See numbered groups and named groups (?<name>…) for every match, including groups that did not take part.
Switch global, ignore case, multiline, dotAll and unicode on and off with a click.
Try a replacement string with $1, $& or $<name> and see the result before using it.
Patterns that take too long are stopped with a clear warning, so catastrophic backtracking cannot freeze your tab.
Invalid patterns show the exact problem instead of failing silently.
Type your regular expression between the slashes.
Tick the flags you need, such as g for all matches.
Paste the text to search. Matches highlight instantly.
Check groups and the replacement preview, then copy your pattern.
Quick answers about using the MoSanKit Regex Tester.
JavaScript (ECMAScript). Most basic syntax is shared with other languages, but features such as lookbehind, named groups and flags can differ between flavours.
g finds all matches, i ignores case, m makes ^ and $ match at each line, s lets the dot match line breaks, and u enables full Unicode matching.
Some patterns, such as (a+)+$, can take exponential time on certain input. The tester stops after about a second and warns you, so you can make the pattern more specific.
Use $1, $2 for numbered groups, $& for the whole match and $<name> for named groups.
No. Matching runs in your browser, in a background worker.
Yes, to keep things fast: up to 200,000 characters and the first 1,000 matches.
Explore more free developer tools from MoSanKit.