TEXT TOOL

Find & Replace

Replace every occurrence of a word or pattern in your text.

About this tool

All matching and replacing happens locally using JavaScript's string and regex methods — your text is never uploaded.

How to use Find & Replace

  1. Paste your text into the main box.
  2. Enter what to find and what to replace it with.
  3. Toggle case sensitivity or regex mode if you need more precise matching.
  4. Click "Replace all" and copy the result.

Common use cases

Worked example

Say a product was renamed from "QuickTask" to "TaskFlow" partway through writing a 3,000-word help doc. Set Find to "QuickTask" and Replace to "TaskFlow," and every instance updates in one pass — far faster and less error-prone than manually scanning for each occurrence. With the regex option enabled, a pattern like \d{3}-\d{4} can find every phone-number-shaped string in a block of pasted contact data and replace it in bulk, something plain text search can't do since it can't match a variable pattern, only literal text.

Replacing several words at once

This tool takes one find/replace pair per pass. If several different words should all get the same replacement, turn on “Treat find as regex” and separate them with a vertical bar — colour|color|colr replaced with color fixes all three spellings in one click. Each word needing a different replacement takes its own pass: copy the result back into the Text box and run the next pair.

Things to watch out for

Case sensitivity matters more than it seems — with case-sensitive matching on, searching for "task" won't touch "Task" or "TASK," which is usually what you want for code identifiers but not for prose. When using the regex option, remember that characters like ., *, (, and $ have special meaning in a pattern — searching for a literal period in a price like "$4.99" requires escaping it as \., or the plain-text mode (regex off) will handle it correctly without any escaping needed at all.

Using capture groups in the replacement

With “Treat find as regex” on, parts of the pattern wrapped in parentheses are remembered and can be reused in the Replace box. The tool uses JavaScript’s standard replace rules:

Worked example: to turn a list of names written as “Smith, John” into “John Smith”, find (\w+), (\w+) and replace with $2 $1. Each line’s last name is group 1 and first name is group 2, so they swap in one pass.

These codes also work with regex off. A plain replacement such as $10 is left alone, but $& and $$ still get their special meaning, so type $$& if you really want the characters $& in your output.

Cleanup recipes

All of these need regex mode on:

How this tool reads patterns

Patterns always run with the global flag, so every match is replaced, and with the case-insensitive flag unless “Case sensitive” is ticked. The multiline and dotAll flags are not set, which has two effects. First, ^ and $ match only the very start and end of the whole text, not of each line, which is why the trailing-space recipe above uses a lookahead instead of $ alone. Second, . does not match a line break, so a pattern like start.*end will not match across lines. Use [\s\S]* in place of .* when you need that.

Be careful with patterns that can match nothing at all, such as x*. They match the empty gap between every character, so the replacement is inserted everywhere: x* replaced with a dash turns “abc” into “-a-b-c-” and reports 4 replacements. To test a pattern before replacing, try the Regex Tester.

Frequently asked questions

What does "Treat find as regex" change?

With it off, your search text is treated literally (special characters like . or * are escaped automatically). With it on, your search text is compiled as a real regular expression, letting you match patterns like digits, whitespace, or optional characters.

Does this replace text on my server or in a file?

No — it only replaces text within the box on this page. To apply changes to a real file, paste the result back into your editor or document.

Why did it report 0 replacements when I expected matches?

Check case sensitivity first — by default the search is case-insensitive unless you enable "Case sensitive." If using regex mode, also confirm the pattern is valid and not accidentally over-escaped.

How do I use capture groups in find and replace?

Turn on regex mode, wrap the parts you want to keep in parentheses in the Find box, then refer to them in the Replace box as $1, $2 and so on, numbered from the left. For example, finding (\d{3})-(\d{4}) and replacing with $2-$1 swaps the two halves of every number written in that pattern.

Can I insert a line break as the replacement?

Not by typing one, because the Replace field is a single-line box and typing \n there inserts a backslash and the letter n. You can keep existing line breaks by capturing them, for example finding (\n)\s*\n and replacing with $1 to remove blank lines while keeping one break between the remaining lines.

Why does my ^ or $ pattern only change the first or last line?

This tool does not set the multiline flag, so ^ matches only the very start of the text and $ only the very end. To target the start of every line, match the line break itself, for example (\n)- to find a dash at the start of each line after the first, or use a lookahead such as (?=\n) for line ends.