Skip to content

Find and Replace

Find and replace text with regular expressions, capture groups, case-sensitive matching, and a live match count.

Find and Replace tool

Loading...

Example

Input: Text: The cat sat on the cat mat. Find: cat, Replace with: dog

Result: The dog sat on the dog mat (2 matches found)

Every occurrence of the search text is replaced. Turn on Use Regex to search with a regular expression pattern instead.

Handy Regex Replacements

FindReplace withBeforeAfter
\s+(one space)too many spacestoo many spaces
(\d{4})-(\d{2})-(\d{2})$3/$2/$12026-09-2525/09/2026
\bcat\bdogcat, category, cat.dog, category, dog.
^- (dash, space)milk / eggs (two lines)- milk / - eggs
(\w+)@(\w+)$2-$1user@exampleexample-user
[aeiou](empty)banana splitbnn splt
\d+#Order 66 of 1138Order # of #

All with Use Regex turned on and Case Sensitive off.

  1. Paste or type the text you want to search through into the Input Text area.
  2. Enter the search term or regular expression pattern in the Search field.
  3. Enter the replacement text in the Replace With field.
  4. Toggle Use Regex or Case Sensitive to refine your search.
  5. Check the match count and review the Result panel, where every match is already replaced.
  6. Click the Copy button to copy the result.

Find and Replace With Plain Text or Regex

Find and Replace swaps every match of a word or pattern in your text for something else. Type what to find and what to put in its place. The Result panel shows the new text, with a live count of matches, and your original text is never changed.

By default the search is plain text and ignores case, so "cat" also finds "Cat" and "CAT". Turn on Case Sensitive for exact matches. A plain search finds text anywhere, even inside longer words, so "cat" also matches the start of "category".

Turn on Use Regex to search with a regular expression, which is a short pattern that describes text. \d+ matches any number, \s+ matches a run of spaces, and \b marks the edge of a word, so \bcat\b finds only the word cat. Put part of a pattern in parentheses to capture it, then reuse it in the replacement as $1, $2 and so on. That is how you turn 2026-09-25 into 25/09/2026 in one step. The ^ and $ signs match the start and end of each line. The tool uses JavaScript regex rules, and a broken pattern shows an error instead of a result.

New to regex? The Regex Cheatsheet lists the common symbols with examples. The Regex Tester highlights each match, so you can check a pattern before you replace anything.

Frequently Asked Questions

Turn on Use Regex and put \b on both sides of the word, as in \bcat\b. The \b means a word edge, so the pattern matches "cat" on its own but not the "cat" inside "category" or "concatenate". Punctuation next to the word is fine, so "cat," and "cat." still match.
Turn on Use Regex and wrap each part you want to keep in parentheses. In the Replace With box, refer to the parts as $1, $2 and so on. For example, search for (\w+), (\w+) and replace with $2 $1 to turn "Smith, John" into "John Smith". Use $& to insert the whole match.
You can match line breaks with \n in regex mode, for example to join lines by replacing \n with a comma and a space. You cannot add new line breaks, because the Replace With box is a single line. To add text at the start of every line, search for ^ with regex on and type the text to insert.
In plain mode, just type it: the replacement is inserted exactly as written. In regex mode, the dollar sign is special because $1 or $& refer to parts of the match. Type $$ to get a single $ in the result, so $$5 inserts "$5" rather than the fifth capture group.

Related Tools

Text Diff and Compare Tool

Compare two blocks of text side by side and highlight the differences. Find additions, deletions, and changes instantly.

Text and Writing

Word Counter and Character Counter

Count words, characters, sentences, and paragraphs in your text. Includes reading time and speaking time estimates.

Text and Writing

Remove Duplicate Lines

Remove duplicate lines from text while keeping the original order. Supports case-sensitive and case-insensitive modes.

Text and Writing

Case Converter

Convert text between UPPER, lower, Title, Sentence, camelCase, snake_case, kebab-case, CONSTANT_CASE, and PascalCase.

Text and Writing

Whitespace Remover and Trimmer

Remove extra whitespace, trim leading and trailing spaces, collapse multiple spaces, and clean up messy text formatting.

Text and Writing

Regex Cheatsheet

Interactive regex syntax reference with descriptions, examples, and a try-it-live tester for each pattern.

DevOps Tools