Find & Replace
Find and replace across text with plain, whole-word or regex matching, capture groups, a live match count and a preview before you commit.
Runs entirely in your browser — nothing is uploadedText
Drop a file or click to browse
or drop a text filePreview
About the Find & Replace
Paste or drop in text, type what you are looking for, and every hit appears struck through with its replacement beside it before anything is committed. Three matching modes cover the usual work: plain text, where every character is literal; whole word, so replacing id does not maul identifier or video; and regular expression, with $1 capture-group references, $<name> named references, $& for the whole match, and the m, s and u flags. A running count tells you how many occurrences you are about to change, the compiled pattern is shown so nothing is hidden, and nothing in your text moves until you press Replace all — which is undoable, twenty-five passes deep.
The non-obvious trap in find-and-replace is that $ is not always just a dollar sign. JavaScript's own String.replaceAll honours $&, $1 and $$ as substitution syntax even when the search term is an ordinary string, so a plain replacement of US$ 5 comes out mangled in a great many home-grown scripts and more than a few web tools. Here $ is inserted literally in plain and whole-word mode, is special only in regex mode, and the tool tells you which behaviour is in force. Two further regex traps are flagged as you type rather than failing quietly: $0 is not the whole match in JavaScript — that is $& — so it is inserted literally; and $<typo> against a pattern that does define named groups is replaced by nothing at all, an empty string, which is exactly the kind of edit you discover three commits later.
Whole-word matching uses lookaround, (?<!\w)…(?!\w), rather than the \b most editors reach for. \b is a boundary between a word character and a non-word character, so \b.NET\b finds nothing whatsoever — the term begins with punctuation — and the same is true of $var, --flag and #tag. The lookaround form finds all of them and still refuses to match inside ASP.NET. Preserve case carries each match's own capitalisation onto the replacement, so a single pass turns cat, Cat and CAT into dog, Dog and DOG. And because a one-line input box cannot hold a line break, an optional escape mode reads \n, \t, \r, \xHH and \uXXXX in the Find and Replace fields — which is how you collapse lines, split on commas, or strip Windows carriage returns.
Two honest limits. A regular expression with nested quantifiers — the classic (a+)+b — backtracks catastrophically, and that runaway work happens inside a *single* match attempt, which JavaScript offers no way to interrupt. The time budget here is checked between matches, so it will stop a slow run but it cannot save you from that one; if you are experimenting with a risky pattern, the Regex Tester runs matching in a background worker that can be killed outright. Dropped files are capped at 8 MB and are decoded as UTF-8 only, so a UTF-16 or Latin-1 file is refused or flagged rather than handed back full of replacement characters. And when a run does hit its time budget or its match ceiling, you get an error and your original text — never a document in which only the first half of the occurrences were replaced.
Everything runs inside your browser using standard web APIs. Your data is never uploaded, never stored on a server, and never leaves your device — you can confirm that by opening your browser devtools Network tab, or by switching off your Wi-Fi and using the tool offline.
Frequently asked questions
Why is my $1 inserted literally instead of the captured text?
Two possibilities. Either you are in plain text or whole-word mode, where the replacement goes in exactly as typed and $ has no special meaning — switch the Match control to Regular expression. Or the pattern has fewer capture groups than the number you referenced: JavaScript leaves an out-of-range $7 as literal text rather than raising an error, and the tool warns you when it spots one. Note also that $0 is always literal in JavaScript; the whole match is $&.
How do I find or insert a line break?
In regular expression mode, \n in the pattern already means a newline. Everywhere else, switch on the escapes toggle and \n, \t, \r, \xHH and \uXXXX are interpreted in both the Find and the Replace fields. Files written on Windows end lines with CRLF, so search for \r\n if replacing a plain \n leaves stray carriage returns behind.
Does whole word work for terms like .NET, $var or C++?
Yes, and that is deliberate. Whole word here wraps your term in (?<!\w) and (?!\w), meaning it must not be directly preceded or followed by a letter, digit or underscore. Editors that use \b cannot find those terms at all, because \b needs a word character on one side of the boundary. The consequence worth knowing is that C++ inside C++11 will not match, since 1 is a word character.
What happens if my pattern can match an empty string?
It runs, and you get a warning. A pattern such as a* or \b matches at the positions between characters, so the replacement is inserted throughout rather than substituted for anything — check the preview before applying. Empty matches always advance by a whole code point here, so such a pattern can never split an emoji into two broken halves the way a naive loop does.
How large a file can I run this on?
Dropped files are capped at 8 MB; pasted text is limited by your device's memory rather than any quota. Past roughly a million characters the live preview starts to stutter, because it recomputes as you type. Each run has a time budget: if it is exceeded the run stops, you are told why, and your text is left exactly as it was, because a half-replaced document is worse than no result at all.
Can I undo a replacement, and is anything saved?
Replace all pushes the previous text onto an undo stack twenty-five entries deep, so you can chain several passes and walk back through them. Nothing is written to disk or to browser storage — reloading the page starts you from an empty box, and there is no history to leak.