My Tool Studio
Text

Find and Replace Text

Paste your text or open a file, enter what to find and what to replace it with, and this find and replace text tool updates the result as you type. Add up to 50 rules, or paste them as CSV, and they run in one pass from top to bottom, each with its own match count. Every match is highlighted in your text before you copy anything. Whole word only stops cat from matching inside concatenate, and you can replace all matches or only the first. Regex mode supports $1 capture groups, and \n works for line breaks in either mode, so a list turns into comma-separated text in one rule. Use as input chains several passes with undo. Your text stays in the browser.

Always freeNo sign upRuns in your browser
0
0 replacements made

How to use

01

Paste your text

Paste into the Input box on the left. Press Try sample to load a short text with two rules already set up, one for a domain and one for a whole word.

02

Add find and replace rules

Fill Find and Replace with. Click Add rule for more pairs, up to 50, or Paste rules as CSV to load a list of find,replace lines. Leave Replace with empty to delete matches.

03

Set options and copy

Tick Whole word only, Case-insensitive, Replace all matches or Regex as needed. Check the highlighted matches and the total, then press Copy or download the result as .txt.

Why Find and Replace Text

Regex cheat sheet for find and replace

Tick Regex before using these patterns. The Multiline column says whether that option must be on. Patterns are JavaScript regular expressions, and they run on the whole text at once. Each pattern can go in its own rule, so you can stack several of them in one pass.

FindReplace withMultilineWhat it does
\n, NoJoins lines into one comma-separated line
{2,} (one space)NoCollapses double and triple spaces to one
[ \t]+$(empty)YesRemoves spaces and tabs at the end of every line
^- YesAdds a dash and space to the start of every line
(\w+) (\w+)$2 $1NoSwaps two words, for example first and last name
[\w.+-]+@[\w-]+\.[\w.]+[email]NoMasks email addresses
https?://\S+(empty)NoDeletes web links

Common questions

How do I find and replace multiple words at once?
Click Add rule and enter a find and replace pair on each row, up to 50 rules, or click Paste rules as CSV and paste one find,replace pair per line. All rules run in one pass from top to bottom, so a later rule sees the text after earlier rules have changed it. Use the arrow buttons to change the order.
How do I replace line breaks with commas in a find and replace?
Type \n in Find and a comma and a space in Replace with, then tick Read \n as a line break and \t as a tab, or tick Regex, which reads \n the same way. Every line break becomes a comma, which turns a one-per-line list into a single line. To go the other way, find , and replace with \n.
How do I use $1 capture groups in the replacement?
Tick Regex and put parentheses around the parts you want to keep. For example, find (\w+) (\w+) and replace with $2, $1 to turn John Smith into Smith, John. $& inserts the whole match. Without Regex, a $ in the replacement is inserted literally.
How do I match whole words only when replacing text?
Tick Whole word only. A match then cannot touch a letter, digit or underscore on either side, so replacing cat leaves concatenate and cats alone. In plain mode accented and non-Latin letters count as letters too. In Regex mode the check uses the basic A to Z set, so it is designed for English text there.
How do I replace text without worrying about capital letters?
Tick Case-insensitive. Searching for admin then also matches Admin and ADMIN. The replacement is inserted exactly as you typed it, so every match ends up with the same capitalization.
What does the Multiline option change in a regex replace?
It makes ^ and $ match at the start and end of every line instead of only the start and end of the whole text. For example, with Regex and Multiline on, finding ^ and replacing with - adds a dash to the start of every line. It has no effect unless your pattern uses ^ or $.
Why does my find and replace show 0 matches?
Usually the capitals differ, so try Case-insensitive. With Whole word only on, a word followed by a letter or digit will not match. Without Regex, characters like . and * are matched literally, so a pattern that relies on them only works with Regex ticked.
What happens if I type an invalid regular expression?
The rule shows error instead of a match count, a message explains the problem, and the text passes through that rule unchanged. An unclosed bracket or parenthesis is the usual cause. Other rules keep working.
Can I replace only the first match instead of every match?
Yes. Untick Replace all matches (off = first only) and each rule changes just its first match in the text. That is handy for fixing the opening line of a document or the first heading while leaving later mentions alone. The highlight panel then marks only that first match per rule.
How do I find and replace in Google Docs or Word instead?
In Google Docs, open Edit, Find and replace, which also has a Use regular expressions option. In Word, press Ctrl+H; Word uses its own wildcard syntax rather than standard regex. This page is useful when you need several rules at once or want to see match counts before changing a document.

More Text tools

View all