See before and after side by side
Enter the pattern, the flags, the replacement and the input text, and the result appears next to the original. Matches and actual replacements are counted separately, so a missing g flag that changed only the first occurrence is obvious at a glance, and the change in length is reported too. The replacement accepts numbered groups such as $1 and named groups in the $
Caps that stop the page from freezing
A regular expression can explode in the number of attempts it makes on certain inputs. Give a nested quantifier like (a+)+$ a long run of a characters and it can take long enough to look frozen, a behavior known as catastrophic backtracking. A JavaScript regex cannot be interrupted once it starts, so the pattern is capped at 300 characters and the input at 20,000, with the measured time shown alongside. Checked October 2026.
A heuristic warning, and what it cannot promise
When nested quantifiers are spotted or the input passes 2,000 characters, the live preview pauses and the replacement runs only on the Run button. That detection is a heuristic: it does not catch every dangerous pattern, and a flagged pattern is not necessarily slow. The tool does not list match positions or the value of each capture group.
Frequently Asked Questions
Without the g flag, JavaScript replace changes only the first match. Put g in the flags box to change them all; the separate counts for matches and replacements make the difference visible immediately.
It pauses when nested quantifiers are spotted or the input passes 2,000 characters. A JavaScript regex cannot be interrupted once it starts, so combinations that might run long are left for the Run button.
It does not list match positions or the value of each capture group. Match inspection belongs to a regex tester, and explaining a pattern to a regex explainer.