Regex Replace Tester Guide
Preview regex find-and-replace results with capture group references and live highlighting.
A search-and-replace can change more text than you expected. Regex Replace Tester lets you look at the result before applying the same idea in a file or editor. It does not edit any file.
Replace one word
Type cat in Pattern, leave Flags as g, type dog in Replacement, and put cat and cat in Test text. The Preview marks the two cat matches. Under Result, you should see dog and dog. The g flag means “replace every match”.
Remove g from Flags. The result should change to dog and cat: only the first match is replaced. Preview a line that should not change too before using a pattern on real data. For more control, put parentheses around part of the pattern and use $1 in Replacement to reuse the first captured part.
If no text changes
Check the pattern, the flags, and your example text. The pattern uses JavaScript regex rules: . matches almost any character, while \. matches a real dot. An invalid pattern is reported rather than silently applied. Copy result copies only the replacement output.
Where your input goes
Processing runs in your browser. The tool does not upload your input to ilham.dev.
Related guide
For more background, read Testing Regex Before Shipping It.
Questions you might have
- Why do I get no replacements with a non-global flag?
- Without
g, only the first match is replaced. If you see none, check that the pattern matches the example text and does not have an invalid flag.