How to Find and Replace Text Online
Need to rename a variable across a thousand lines, strip unwanted tags from HTML, or swap a word while keeping its original casing? Here's how to find and replace text in seconds.
TL;DR: Need to quickly replace text across a large document? The Find and Replace Text tool lets you replace every occurrence in one click, with support for whole-word matching, regex patterns, and case-preserving replacements. Everything runs in your browser.
You're cleaning up a document and need to change every instance of "colour" to "color". Or you have a log file where an old hostname must be swapped for a new one across hundreds of lines. Doing this manually means scrolling, searching, and hoping you don't miss one.
TextModifier's Find and Replace Text tool handles all of this in your browser: plain text, whole-word matching, regular expressions, and even case-preserving replacements.
How It Works
- Paste your text into the input area
- Enter the text or pattern to find
- Enter the replacement text (or leave it empty to delete matches)
- Click Replace
The tool shows the result in the output area and tells you exactly how many occurrences were replaced. If nothing matches, you get a clear "No matches found" message.
Case Sensitive Matching
By default, the search is case-insensitive. Searching for "apple" matches "Apple", "APPLE", and "apple". Enable Case sensitive to restrict matches to the exact casing you type.
This matters when your text contains identifiers that differ only by case. Replacing id without case sensitivity could match Id, ID, and every word containing those letters. Case-sensitive mode eliminates those false matches.
Replacing All or Just the First Match
Replace all occurrences is enabled by default, so every match in the text gets replaced. Disable it to replace only the first match, useful when you need to change a single instance without affecting the rest.
Matching Whole Words Only
Enable Match whole word to avoid partial matches inside longer words. Searching for "cat" normally matches "cat", "catalog", and "concatenate". With whole-word matching, only standalone "cat" is replaced.
This is especially useful when renaming variables or keywords that appear as substrings of other terms.
Regular Expression Mode
Enable Regular expression to treat the search text as a JavaScript regex pattern. This unlocks pattern-based matching:
\d+matches one or more digits\bfoo\bmatches the whole word "foo"(error|warning)matches either "error" or "warning"^#.*$matches lines starting with#(when combined with multiline mode)
You can use capture groups in the replacement text. $1, $2, etc. refer to matched groups from the pattern.
When regex mode is active, Match whole word is automatically disabled since you can express word boundaries directly in your pattern with \b.
Multiline Mode
Enable Multiline mode (available when regex is on) to make ^ and $ match the start and end of each line, not just the entire text. Without this, ^ only matches the very beginning of the input and $ only matches the very end.
This is essential for line-by-line pattern matching. For example, ^TODO:.*$ with multiline mode finds every line that starts with "TODO:". Without it, the pattern only matches if the entire text starts with "TODO:".
Preserving the Original Case
Enable Preserve case to keep the original casing pattern when replacing. The tool detects three patterns:
- ALL UPPERCASE: replacement is converted to uppercase
- all lowercase: replacement is converted to lowercase
- Title Case (first letter uppercase, rest lowercase): replacement follows the same pattern
For example, searching for "cat" and replacing with "dog" while preserve case is enabled produces:
- "cat" → "dog"
- "Cat" → "Dog"
- "CAT" → "DOG"
This is invaluable when correcting a word that appears in headings, sentences, and constants, so each gets the right casing without manual editing. Preserve case is only available when Case sensitive is off, since case-sensitive mode already implies exact casing.
Common Use Cases
Renaming Variables in Code
Search for oldName and replace with newName across an entire file. Enable Match whole word so oldNameHelper and getOldName are not affected.
Cleaning Up HTML or Markdown
Use regex mode to strip tags: search for <\/?em> and replace with nothing to remove all <em> and </em> tags. Or replace ** with nothing to strip Markdown bold markers.
Normalizing Spelling
Replace "colour" with "color", "organisation" with "organization", or any regional variant. Enable Preserve case to handle "Colour", "COLOUR", and "colour" in a single pass.
Fixing Delimiters
Replace tabs with commas, commas with semicolons, or any delimiter with another. Useful for converting between CSV, TSV, and other data formats.
Removing Unwanted Text
Leave the replacement field empty to delete every match. Search for \s*//.*$ in regex multiline mode to strip single-line comments from code.
Pattern-Based Transformations
Use regex capture groups to restructure text. Search for (\w+),\s*(\w+) and replace with $2 $1 to swap first and last names in a comma-separated list.
Privacy and Speed
TextModifier processes everything in your browser. No text is uploaded to a server. No accounts, no tracking, no data storage. The replacement happens instantly on your device.
Start Finding and Replacing Text
Stop scrolling through documents hunting for every occurrence by hand. Paste your text into the Find and Replace Text tool and make every replacement in one click.
Take your tools on the go
Download the TextModifier™ app for quick access to all your favorite text tools, anytime, anywhere.