What is a find and replace tool?

A find and replace tool scans a block of text for a specified pattern — either a plain string or a regular expression — and substitutes every match with replacement text. It is the same operation available in every text editor (Ctrl+H / Cmd+H), but available online without needing to open any application, and with regex support built in.

The web-based version is especially useful for quick one-off replacements on pasted content, where opening a code editor would be slower than opening a browser tab. Writers use it to swap out brand names, fix recurring typos, and reformat copy. Developers use it to transform data formats, rewrite identifiers, and clean imported text files. Data analysts use it to normalize spreadsheet exports before further processing.

This tool supports four flags — regex mode, case-insensitive, global replacement, and multiline — which can be combined freely to match any text transformation scenario. The output and match count update in real time as you type.

How to use the find and replace tool

  1. 1
    Paste your text

    Paste the text you want to modify into the left input panel. The right panel shows the result with replacements applied.

  2. 2
    Type your find pattern

    Enter the word, phrase, or regex pattern you want to find. In plain text mode, every character is treated literally. In regex mode, use standard regular expression syntax.

  3. 3
    Enter replacement text

    Type the replacement in the Replace field. Leave it empty to delete all matches. In regex mode, use $1, $2 to reference capture groups from the find pattern.

  4. 4
    Set flags and copy

    Toggle Global (replace all vs first only), Case-insensitive, Regex, and Multiline as needed. When the output looks correct, click Copy to grab it.

Regular expression quick reference

Regular expressions (regex) are patterns that describe sets of strings. They unlock powerful transformations that plain text search cannot perform — matching any digit, any whitespace, patterns of varying length, or specific positions in the text. This tool uses JavaScript regex syntax (compatible with ECMAScript / PCRE-like patterns):

PatternMeaningExample match
.Any character except newline"h.llo" matches "hello", "hXllo"
\dAny digit (0–9)"\d+" matches "42", "007", "2024"
\wWord character (a-z, A-Z, 0-9, _)"\w+" matches "hello", "user_name"
\sWhitespace (space, tab, newline)"\s+" matches sequences of spaces/tabs
+One or more of the preceding"a+" matches "a", "aa", "aaa"
*Zero or more of the preceding"a*" matches "", "a", "aaaa"
?Zero or one (optional)"colou?r" matches "color" and "colour"
^Start of line (with multiline flag)"^Hello" matches "Hello" at line start
$End of line (with multiline flag)"world$" matches "world" at line end
[aeiou]Any character in the set"[aeiou]" matches any single vowel
[^aeiou]Any character NOT in the set"[^aeiou]" matches any non-vowel
(x)Capture group"(\w+)@" captures username in email
x|yMatch x or y"cat|dog" matches "cat" or "dog"
\bWord boundary"\bword\b" matches whole word only

Practical examples with regex

Remove all blank lines
Find
^\s*$\n?
Replace
(empty)
Flags: Regex + Global + Multiline

Matches lines containing only whitespace (including completely empty lines) and deletes them. Useful for cleaning up pasted text with excessive spacing.

Swap first and last name
Find
(\w+)\s+(\w+)
Replace
$2, $1
Flags: Regex + Global

Captures two words and outputs them reversed with a comma. Turns "John Smith" into "Smith, John". Useful for normalizing name lists for mail merges or CRM imports.

Remove HTML tags
Find
<[^>]+>
Replace
(empty)
Flags: Regex + Global

Matches any HTML tag (opening or closing) and removes it, leaving only the text content. Useful for extracting plain text from copied web content.

Add http:// to bare URLs
Find
(?<!https?://)\bwww\.\S+
Replace
https://$&
Flags: Regex + Global

Finds URLs starting with "www." that do not already have a protocol and prepends "https://". Useful for normalizing link lists in content.

Find and replace vs. text editor: when to use which

Most code editors (VS Code, Sublime Text, Notepad++) have built-in find-and-replace with regex support. This tool is not a replacement for those — it is a supplement for cases where opening an editor adds unnecessary friction:

Use this web tool when
  • You need a quick one-off replacement on pasted content
  • You are on a machine without your usual editor installed
  • You want to share the transformation with a non-technical colleague
  • You are working on a phone or tablet
  • You do not want to save an intermediate file
Use a text editor when
  • You need to replace across multiple files at once
  • Your input is a large file (megabytes of text)
  • You need a preview of each match before replacing
  • You need undo history for multiple replacement operations
  • You are working on production code that needs version control

Related text tools

FAQ

Common questions

What is the difference between plain text and regex mode?

In plain text mode, the find field is treated as a literal string — every character is searched for exactly as typed, including special characters like . * + ? ( ). In regex mode, the find field is interpreted as a regular expression pattern, allowing wildcard matching, character classes, quantifiers, and capture groups for advanced replacements.

How do I use capture groups in the replacement?

Enable regex mode. In the find field, wrap the part you want to capture in parentheses: (\d+). In the replace field, reference it with $1, $2, etc. For example, find "(\w+) (\w+)" and replace with "$2 $1" to swap two words. This follows standard JavaScript RegExp replacement syntax.

What does the Global flag do?

When Global is enabled (default), every occurrence of the find pattern in the text is replaced. When disabled, only the first match is replaced. This mirrors the behavior of the g flag in regular expressions.

What does case-insensitive mode do?

With case-insensitive mode on, the find pattern matches regardless of letter case. So searching for "apple" would also match "Apple", "APPLE", and "aPpLe". The replacement text is inserted with the exact casing you typed in the replace field — the original case is not preserved.

How do I delete all occurrences of a word?

Leave the replace field empty and type the word (or pattern) you want to remove in the find field. Every match will be replaced with an empty string, effectively deleting it from the output.

Can I use regex to remove all blank lines?

Yes. Enable regex mode and enter ^\s*$\n? or ^\n in the find field with the replace field empty. This matches lines that contain only whitespace (or nothing) followed by an optional newline and removes them. You can also use the Duplicate Line Remover or Whitespace Remover tools for simpler blank-line handling.

Are my changes applied live as I type?

Yes. The output updates in real time as you type in the input, find, or replace fields, and as you toggle any option. There is no button to click — the result is always up to date.

How do I escape special characters in plain text mode?

In plain text mode, you do not need to escape anything — all characters are literal. If you type "user.name" in the find field, it searches for exactly that string including the dot. Only in regex mode do you need to escape special characters by preceding them with a backslash (e.g., \. to match a literal period).

What is the multiline flag and when do I need it?

The multiline flag (m) changes how ^ and $ work in regex. Without multiline, ^ matches the start of the entire text and $ matches the end. With multiline, ^ matches the start of each line and $ matches the end of each line. Enable it when your pattern uses ^ or $ to target line boundaries rather than text boundaries.

More in Text & Writing