Text Find and Replace

When a client renames their product halfway through a draft, or you need to swap every placeholder {FIRST_NAME} in an email template, opening a word processor for three hundred replacements is overkill. Paste the text, set your find-and-replace pair, toggle case sensitivity or regular-expression mode, and this tool rewrites every hit and shows a counter of how many matches it swapped.

How to find and replace text

  1. 1

    Paste the text

    An article, template, log file or any plain string.

  2. 2

    Enter the pattern to find

    A literal word or phrase, or a regular expression when the regex toggle is on.

  3. 3

    Enter the replacement

    Leave it blank to delete matches; in regex mode reuse capture groups like $1, $2.

  4. 4

    Pick options

    Toggle case-sensitive matching, and regex mode for advanced searches.

  5. 5

    Replace and copy

    See the match count and copy the rewritten text in one click.

Option cheat sheet

Option What it changes
Case-sensitive Apple matches only Apple, not apple or APPLE (applies to plain, non-regex searches)
Regular expression The find field is read as a PCRE pattern, wrapped in delimiters such as /pattern/
Inline flags Add flags after the closing delimiter: i ignores case, s lets . match newlines, m makes ^ and $ match at line breaks
Replace all Every match is replaced; there is no “first match only” mode

Useful regex patterns

  • Strip HTML tags: /<[^>]+>/
  • Collapse multiple spaces: / {2,}/ to a single space
  • Remove URLs: /https?:\/\/\S+/
  • Mask phone numbers: /\d{3}-\d{3}-\d{4}/ to ***-***-****
  • Smart quote to straight quote: /[‘’]/ to '
  • Capture first word of each line: /^(\w+).*$/m to $1

Capture groups save time

In regex mode, parentheses capture the matched portion and $1, $2 reuse them in the replacement. To swap first and last names in a CSV column:

  • Find: /(\w+),\s*(\w+)/
  • Replace: $2 $1

Common pitfalls

  • Missing delimiters. In regex mode the pattern must be wrapped, for example /foo/. Without delimiters the search fails and the text comes back unchanged.
  • Greedy matches. /<.+>/ eats everything from the first < to the last > on a line. Use /<.+?>/ for lazy matching.
  • Special characters. ., +, *, ?, (, ), [, ], \, |, ^, $ are regex operators. Escape them with a backslash when you want the literal character.
  • Case toggle in regex mode. The case-sensitive toggle applies to plain searches; in regex mode control case with the i flag instead.
  • Backreferences in the replacement. Reuse a group with $1 or ${1}. To output a literal $ before a digit, escape it as \$.
  • Newlines. Windows \r\n and Unix \n look identical on screen; a mismatch breaks line-end patterns.

Frequently Asked Questions

PCRE (Perl-Compatible Regular Expressions), the engine PHP, Perl and grep -P share. Wrap your pattern in delimiters such as /pattern/ and add flags like i or s after the closing delimiter. A few JavaScript- or Python-only shortcuts may not translate directly.

Thousands without any issue. Very large inputs are limited by the request size and processing time; for huge files use a command-line tool like sed or an editor with a streaming replace.

Not inside the tool. Keep the original text in another tab, or paste it into a versioned editor first so you can roll back.

The find-and-replace runs on our server: your text is submitted to perform the replacement and is not stored after the response. For confidential material, prefer an offline editor.

Related Tools

Tool available in other languages