Text Replacement
Find and replace text in a pasted block, as plain text or regex, with a case option. Replace All gives the result and the number of replacements made. How it works
Use the Text Replacement
About the Text Replacement
Replacing “cat” with “dog” in “cat concat cat” gives “dog condog dog”: plain text matches inside words, and every match is replaced. Type Find, Replace With and the text, then press Replace All. Tick Whole words only to get “dog concat dog” instead, Use Regex for patterns and Case Insensitive to ignore capitals. The result clears as soon as you change any input.
Codes you can type in Replace With
| Replace With | Inserts | Find, and text | Result |
|---|---|---|---|
| [$&] | the matched text | a in xaz | x[a]z |
| [$`] | the text before the match | a in xaz | x[x]z |
| [$'] | the text after the match | a in xaz | x[z]z |
| $$ | a dollar sign | a in xaz | x$z |
| $1 | nothing special in plain mode: stays as typed | a in ab | $1b |
| $2$1 | capture groups 2 and 1 (Use Regex on) | (a)(b) in ab | ba |
The same rules as String.prototype.replace in JavaScript. In plain mode the Find text has no capture groups, so $1 is left as typed.
Regex examples (Use Regex on)
| Find | Replace With | Original Text | Result |
|---|---|---|---|
| [0-9]+ | # | a1b22 | a#b# |
| ([0-9]+)-([0-9]+)-([0-9]+) | $3/$2/$1 | 2026-10-14 | 14/10/2026 |
| (\w+) (\w+) | $2, $1 | Jane Smith | Smith, Jane |
| \s+ | _ | a b c | a_b_c |
| a\.b | x | a.b.c | x.c |
| . | x | a😀b | xxxx |
The last row shows regex mode working on UTF-16 code units: the emoji is two units, so a 3-character text gives 4 matches. Plain text, with 😀 as Find, replaces the emoji whole.
How to use this tool
- Paste or type the text in Original Text.
- Type what to look for in Find and its replacement in Replace With.
- Tick Whole words only to skip matches inside longer words, Use Regex to treat Find as a pattern, and Case Insensitive to ignore capitals.
- Press Replace All, then use the copy button on the Result.
Frequently asked questions
- How do I find and replace text online?
- Paste the text in Original Text, type Find and Replace With, and press Replace All. Nothing changes while you type; the result appears when you press the button. To replace cat with dog in “cat concat cat”, the result is “dog condog dog”.
- Does it replace every match or only the first?
- Every match, and the page says how many: “cat concat cat” gives 3 replacements made. Matching is case sensitive by default, so “Cat cat CAT” with cat replaced by dog gives “Cat dog CAT”. With Case Insensitive ticked it gives “dog dog dog”. Plain text also matches inside words, so cat in “cat concat cat” gives “dog condog dog”; tick Whole words only and it gives “dog concat dog”. A whole-word match cannot touch a letter, digit or underscore where the Find text starts or ends with one, so c++ still matches in “c++ code”. With Use Regex on, write \b in the pattern instead.
- How do I use regex to find and replace?
- Tick Use Regex and write a JavaScript pattern in Find. Parentheses make capture groups that Replace With can reuse as $1, $2 and so on: (\w+) (\w+) with $2, $1 turns “Jane Smith” into “Smith, Jane”. An invalid pattern shows its error under the Find field.
- Why did my result disappear?
- The result belongs to the inputs it was made from. When the text, Find, Replace With or any checkbox changes, the result is cleared and the page says the inputs changed, so what you see is never out of date. Press Replace All again.
- Why does a dot match only half of an emoji in regex mode?
- Regex mode works on UTF-16 code units, and an emoji such as 😀 takes two of them. Replacing . with x in “a😀b” gives “xxxx”. Use plain text for emoji: 😀 replaced by [X] in the same text gives “a[X]b”.
- Can it add or remove text at the start of every line?
- Not with ^: the tool has no multiline option, so ^ matches only the start of the whole text, and replacing ^ with “> ” puts it once, at the very beginning. The Regex Tester has the m flag and a replace mode, so ^ there matches every line start. To remove a prefix that never appears elsewhere, plain mode works: replace it with nothing.
Related Tools
View all toolsWord Counter
Paste or type text to count words, characters with and without spaces, sentences, paragraphs and lines, plus reading time at 200 wpm and speaking time at 130.
Case Converter
Convert text to UPPER CASE, lower case, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE in one click.
Reverse String
Reverse text by character, word order, letters in each word or line order. Emoji, flags and accented letters stay whole instead of breaking apart.
Remove Duplicate Lines
Remove duplicate lines, or comma, tab or space separated items, keeping the first or last copy, with case, trimming, blank-line and sort options.
Lorem Ipsum Generator
Generate lorem ipsum placeholder text as paragraphs, sentences or words, up to 100 paragraphs or 5,000 words, with optional HTML paragraph tags.
Random Text Generator
Generate 1 to 100 sentences or paragraphs picked from a fixed list of 20 well-known sayings. Useful as filler text and writing prompts.