What is find and replace?
Find and replace searches a block of text for a word, phrase or pattern and swaps every occurrence for something else. This tool works on whatever you paste: it replaces all matches at once, ignores case unless you tell it not to, and can treat the search as a JavaScript regular expression for pattern-based edits such as reformatting dates or stripping whitespace.
How to find and replace
- Paste your text into the input box.
- Type what to look for in Find, and the new text in Replace with. Leave Replace with empty to delete the matches.
- Tick Case sensitive or Treat "Find" as a regular expression if you need them.
- Click Convert and copy the result.
If Find is empty, the text comes back unchanged.
Worked example: plain text
Input: Color, color, COLOR. The colour of the colorful sky.
| Find | Options | Result |
|---|---|---|
color |
none | shade, shade, shade. The colour of the shadeful sky. |
color |
Case sensitive | Color, shade, COLOR. The colour of the shadeful sky. |
\bcolou?r\b |
Regular expression | shade, shade, shade. The shade of the colorful sky. |
The first row shows the two usual surprises: all three capitalizations become lowercase shade, and colorful turns into shadeful because the search matches inside words. The regex in the third row fixes both problems for this case. \b limits it to whole words, and u? makes the u optional so the British spelling is caught too.
In plain mode, characters like ., ( and * are matched literally. Finding 5.00 (approx.) replaces exactly that text, and finding . in a.b.c gives a-b-c. Switch on regex mode with the same . and every character is replaced, giving -----, since . means "any character" in a regular expression.
The replacement is literal in plain mode too. Replacing 10 with $10 in Price: 10 gives Price: $10, and $& or $1 typed into Replace with comes out as those exact characters.
Using regular expressions
With the regex option on, Find is compiled as a JavaScript RegExp and the result comes from String.prototype.replace(). The replacement can refer back to what was matched:
| In Replace with | Inserts |
|---|---|
$1, $2 ... |
The text captured by group 1, 2 ... |
$<year> |
The text captured by a named group (?<year>...) |
$& |
The whole match |
$$ |
A literal dollar sign |
Some patterns that are useful on everyday text:
| Task | Find | Replace with |
|---|---|---|
| Reorder dates (2026-10-05 to 05/10/2026) | (\d{4})-(\d{2})-(\d{2}) |
$3/$2/$1 |
| Swap "First Last" to "Last, First" on every line | ^(\w+) (\w+)$ |
$2, $1 |
| Remove indentation from every line | ^\s+ |
leave empty |
| Collapse runs of spaces | {2,} |
a single space |
| Join lines with commas | \n |
, |
| Replace the shortest tag pair, not the longest | <b>.*?</b> |
your text |
The last row matters because * is greedy: in <b>x</b> and <b>y</b>, the pattern <b>.*</b> matches everything from the first <b> to the last </b> as one match. Adding ? makes it stop at the first closing tag, so both pairs are replaced separately. If you're building a pattern, check what it matches in the regex tester before replacing anything.
Limits worth knowing
^and$match at the start and end of each line. The pattern is compiled with thegandmflags (plusiwhen Case sensitive is off), so^(\w+) (\w+)$turnsAda LovelaceandAlan Turingon separate lines intoLovelace, AdaandTuring, Alan. There's no option to anchor to the start of the whole text only; paste just the part you want changed instead..doesn't match line breaks. Use[\s\S]when a match has to span lines.- The replacement can't contain a line break. Replace with is a single-line box, and typing
\nthere inserts a backslash and the letter n. To split text onto separate lines, do that step in a text editor. $is only special in regex mode. There,$&inserts the match and$$becomes a single$. In plain mode every$is kept as typed, so replacing10with$$10gives$$10.- Replacements don't keep the original case. Replacing
applewithpearturnsAppleintopear. Fix capitalization afterwards with the case converter if it matters.
Related tools
- Regex tester: see every match and capture group before you replace.
- Remove Duplicate Lines: after cleaning stray whitespace here, drop repeated lines.
- Text sorter: put the cleaned list in order.
- Code diff: compare the text before and after to review exactly what was replaced.
Last updated