This tool finds every occurrence of a string (or pattern) in input text and replaces it with another string. Everything runs in your browser; nothing leaves your machine.
Literal mode
The default. The tool searches for the exact characters of the search string and replaces every match.
Input: The cat sat on the mat.
Find: cat
Replace: dog
Output: The dog sat on the mat.
Matching is case-sensitive: Cat and cat are different strings. For a case-insensitive replace, switch to regex mode and use a character class such as [Cc]at — the tool doesn’t take regex flags like i.
Literal mode is safe — there’s no special-character interpretation, no patterns to escape. Whatever you type in the find box is exactly what’s matched.
Regex mode
Switches the find string from a literal to a regular expression. This adds capability but requires escaping any literal special characters.
Find regex: \b(\d{3})-(\d{4})\b
Replace: ($1) ($2)
Input: Call 555-1212 or 800-9999.
Output: Call (555) (1212) or (800) (9999).
Two new capabilities:
- Patterns.
\d{3}-\d{4}matches any three-digit-dash-four-digit phone fragment, not the literal text “\d{3}-\d{4}”. - Capture groups.
($1)in the replacement refers to whatever the first parenthesized group matched. Allows transformation, not just substitution.
The regex flavor is JavaScript’s; same as regex tester.
Replacement-string special characters
In regex mode, the replacement string has its own micro-language:
| Sequence | Meaning |
|---|---|
$1, $2, … | Insert the contents of capture group 1, 2, … |
$& | Insert the entire match |
| `$“ | Insert the text before the match |
$' | Insert the text after the match |
$$ | Insert a literal $ character |
To insert a literal $1 in the output, write $$1. Forgetting this is the most common regex-replace mistake — $1.99 in the replacement string tries to use capture group 1 followed by .99.
Case-changing replacements
Some find-replace tools support case transformations in the replacement: \U for uppercase, \L for lowercase, \u for first-letter-upper. JavaScript’s regex engine doesn’t support these natively. The tool above does not offer them; for those transformations, do a regex find with capture groups, then a separate case conversion via text case.
Multi-line and global flags
Regex mode always runs with the global (g) flag — every match is replaced — and no others:
- Global (
g). Replace every match, not just the first. On in regex mode; for a single literal replacement, use the “First only” mode. - Multiline (
m) isn’t set, so^and$match only the start and end of the whole text. To anchor per line, match the newline itself:(^|\n)and(\n|$). - Dotall (
s) isn’t set either, so.stops at newlines. Use[\s\S]to match across lines.
Word boundaries
Find-and-replace often misses or over-matches because of partial-word matches. Replacing cat with dog also changes “category” to “dogegory.”
In regex mode, \b is a word boundary anchor:
Find: \bcat\b
Replace: dog
Input: The cat saw a category.
Output: The dog saw a category.
The literal modes don’t have a whole-word option — switch to regex mode and wrap the word in \b...\b.
Newlines and line endings
Some text input has \r\n line endings (Windows); some has \n (Unix); rarely \r (old Mac). A find pattern that uses \n won’t match a \r\n boundary unless the regex includes \r.
For the most reliable cross-platform line-handling, normalize line endings before find-replace, or use \r?\n in regex mode to match either.
When find-replace isn’t the right tool
- Refactoring code. A regex find-replace can rename a variable but doesn’t understand scope. A code-aware refactoring tool (LSP-based “rename symbol”) handles ambiguity.
- Schema-aware data manipulation. Replacing a JSON value with regex is fragile — escapes and nested quotes break the pattern. Parse the JSON, modify the structure, re-serialize.
- Markdown structural edits. Changing every ”## H2” to ”### H3” works fine with regex. Reordering sections does not — that’s a parsing problem.
- Diffing or comparing. Find-replace transforms one input; for comparing two, see text diff.
Common pitfalls
- Forgetting to escape special characters. In regex mode,
(,),.,?,*,+,[,],\,|,^,$,{,}all have meaning. To match the literal?character, write\?. - Greedy quantifiers in find patterns.
<.*>matches the entire string from the first<to the last>, not each<...>tag. Use<.*?>(lazy) or<[^>]*>(negated character class). - Newlines in literal find. The find box is a single line, so a multi-line search can’t be pasted there. Use regex mode with an explicit
\n. - Forgetting the
gflag. A regex withoutgreplaces only the first match. Always on in this tool’s regex mode, but worth knowing if you ever drop into a more bare-bones regex environment. - Replacing across many files without preview. Always preview before committing changes across a codebase. The tool above writes the result to a separate output box and leaves your input untouched, so compare the two before you copy.
For broader text manipulation, see text case, text reverse, remove duplicate lines, sort lines.