Find and Replace
Paste your text, enter what to find and what to replace it with, results update instantly, with optional regex support.
About the Find and Replace Tool
Type a search term, or a full regular expression once "Use Regex" is switched on, along with a replacement, and every match updates live in the result below as you type. Combine it with "Match whole word only" to skip partial hits buried inside longer words, or "Case-sensitive" when an exact case match matters.
Every keystroke re-runs the match, there's no "Run" button
The find, replace, and both text fields are all wired to an input event listener, and the three checkboxes are wired to change. That means the tool never waits for you to click a button — as soon as you finish typing a character in the search box, the whole pass re-runs against the current text and the result box and the replacement counter update immediately. This is convenient for exploring a pattern interactively, but it also means a slow or catastrophic regex (see below) will visibly lag the page on every keystroke rather than only when you submit.
Case-insensitive is the default, not the exception
Most find-and-replace tools default to exact-case matching and make you opt into loose matching. This one does the opposite: the regex is always built with the global flag g, and the case-insensitive flag i is added unless you explicitly check "Case-sensitive." So searching for "the" with no boxes checked will also catch "The" and "THE." If you're doing a find-replace where case matters — say, replacing a variable name in code without touching an unrelated word that happens to share the same letters in a different case — you need to tick that box first, or you'll silently overwrite more than you intended.
Whole-word matching wraps your pattern in \b, which changes regex meaning
When "Match whole word only" is on, the tool wraps whatever pattern you supplied in word-boundary anchors: \b${pattern}\b. For a plain literal search this behaves exactly as expected. But if you also have "Use Regex" enabled and type a pattern containing an alternation like cat|dog, the wrapping becomes \bcat|dog\b — and because the pipe | has the lowest precedence in regex, that's parsed as either "a word starting with cat" or "a word ending in dog," not "the whole word cat, or the whole word dog." In practice this means "cat" would still match inside "category" even with whole-word matching switched on, because the left side of the alternation only carries the boundary check on the side it's written next to. To get correct whole-word behavior with alternation, wrap the whole pattern in a non-capturing group yourself, e.g. (?:cat|dog), before the boundaries get added.
Regex mode doesn't support $1 capture-group references in the replacement
Native JavaScript string replacement lets you write $1, $2, and so on in a replacement string to insert whatever a capture group matched. This tool doesn't support that, because it passes a function to String.prototype.replace() purely to count matches, and that function always returns your "Replace With" text as a flat, literal string, ignoring any arguments the callback receives. So if you search with the regex (\d+)-(\d+) and type $2-$1 into the replacement field expecting the two numbers swapped, you'll get the literal text "$2-$1" inserted in place of every match instead. Anything you want to keep from the matched text has to be written directly into the pattern (for instance using a lookahead or lookbehind) rather than referenced in the replacement.
Invalid patterns fail safely and show the raw JavaScript error
Because the whole matching step is wrapped in a try/catch block, typing a broken pattern — an unclosed bracket, a dangling quantifier, an invalid backreference — never throws an uncaught error or freezes the page. Instead, the result box switches to an error style and prints the message straight from the JavaScript engine, like "Invalid regular expression: Unterminated group." That's more useful for learning regex syntax than a generic "invalid input" message, since it tells you exactly what the parser choked on, but it also means the wording of the error can differ slightly between browsers since it's whatever each engine's regex parser reports natively.
Nothing leaves your browser
The whole operation — building the pattern, running it against your text, counting matches — happens with JavaScript's built-in RegExp and String.replace() in the page itself. No text is sent to a server, so this is safe to use on text you'd rather not upload anywhere, including snippets pulled from private documents or source code containing credentials you're in the process of scrubbing out.
Frequently Asked Questions
Does this tool support regular expressions?
Yes. Switch on "Use Regex" and the text in the Find field is compiled directly as a JavaScript regular expression instead of being escaped as a literal string. You can use character classes, quantifiers, groups, alternation, and lookaheads/lookarounds supported by the browser's regex engine.
Can I insert a captured group, like $1, into the replacement text?
No. The tool counts matches using a callback function passed to String.replace(), and that callback always returns your "Replace With" text unchanged, so $1/$2-style backreferences in the replacement field are treated as literal characters, not substitutions. Anything you need from the matched text has to be built into the search pattern itself.
Is matching case-sensitive by default?
No, it's case-insensitive by default. The tool always applies the regex's global flag and adds the case-insensitive flag automatically unless you check "Case-sensitive," so out of the box, searching for "cat" will also match "Cat" and "CAT."
Does "Match whole word only" always work correctly with regex patterns?
It works reliably for plain literal searches and for most regex patterns, but patterns using alternation (the | operator) at the top level can behave unexpectedly, because the whole-word wrapping only attaches a word boundary to the outermost sides of the pattern rather than to each alternative individually. Wrap alternatives in a non-capturing group like (?:cat|dog) before relying on whole-word matching with them.
What happens if I type an invalid regular expression?
The tool catches the error instead of crashing and displays the JavaScript engine's own error message in the result box, such as "Invalid regular expression: Unterminated group." The replacement counter resets to 0 until you fix the pattern.
Is my text uploaded to a server when I use this tool?
No. All matching and replacement happens locally in your browser using JavaScript's built-in RegExp engine. Nothing you type is transmitted anywhere, which makes it safe to use on private or sensitive text.