Find and Replace Text Guide — Search, Substitute & Regex
A find and replace tool (also called search and replace, replace text online, or a text replacer) locates a string or pattern in pasted text and substitutes a replacement for each match. This page explains how plain text and regular expression modes work, what each option controls, and how to avoid common substitution mistakes.
What Is Find and Replace?
Find and replace scans a block of text for a find string (or pattern) and writes a replacement string in place of every match — the same core operation as Ctrl+H / Cmd+H in a desktop editor, but usable on pasted content in a browser.
Why it matters: Repeating the same edit dozens of times by hand is slow and error-prone. One pass can fix a misspelled name, rename a token, or strip unwanted characters across an entire paste.
Example: Find colour, replace with color — every British spelling in a draft becomes the American form in one step.
Common mistake: Assuming the tool reads context like a human editor. It matches characters or patterns only — verify the replacement count after each run.
Find and Replace Options Explained
Four toggles control which matches are found and how many are changed. Together they cover most everyday search and replace workflows without opening a code editor.
| Option | When enabled | Typical use |
|---|---|---|
| Match case | Search is case-sensitive — Foo does not match foo | Code identifiers, brand names, log IDs |
| Whole words only | Matches standalone words via word boundaries — cat does not match inside category | Replacing one word without touching compounds |
| Replace only the first occurrence | Only the first match is substituted | Testing a change or editing a single instance |
| Regular expression | Find field is a JavaScript regex pattern, not a literal string | Digits, emails, flexible patterns, capture groups |
Why it matters: Most failed replacements come from the wrong option combination — especially partial-word matches or case mismatches.
Example: To rename user without touching username, enable whole words only. Leave match case off to catch User and USER too.
Default behavior: With all options off, search is case-insensitive, matches substrings (not whole words only), replaces every occurrence, and treats the find field as plain text.
Edge case: In regex mode, the find field is interpreted as a pattern — disable regex for literal strings that contain dots, parentheses, or dollar signs.
Plain Text vs Regular Expressions
Plain text mode treats every character in the find field literally — a period is a period, not “any character.” Regular expression (regex) mode treats the find field as a pattern that can describe many strings at once.
Why it matters: Plain mode is faster and safer for simple swaps. Regex mode unlocks digit matching, optional groups, and backreference replacements — but invalid patterns produce errors instead of changing your text.
Example — plain: Find price $10.00 matches that exact string including the dollar sign and periods.
Example — regex: Find \d+ matches any run of digits — 42, 007, 2024.
Common mistake: Enabling regex to find (draft) when you mean the literal parentheses — escape them as \(draft\) or switch to plain mode.
Capture groups and backreferences
Parentheses in a regex create a capture group. In the replacement field, $1 inserts the first group’s match, $2 the second, and $& the full match.
Why it matters: Backreferences reorder or reformat matched text without manual editing.
Example: Find (\w+) (\w+), replace with $2, $1 — turns John Smith into Smith, John.
Edge case: Use $$ in the replacement field for a literal dollar sign.
Regex Quick Reference
TextTools uses JavaScript RegExp syntax (ECMAScript). Enable regular expression mode before using these patterns.
| Pattern | Meaning | Example match |
|---|---|---|
\d+ | One or more digits | 123, 99 |
\w+ | Word characters (letters, digits, underscore) | hello, user_1 |
\s+ | Whitespace runs | Spaces, tabs |
\bword\b | Whole word boundary | word not inside password |
^line | Start of a line (with multiline patterns) | Line beginnings |
text$ | End of a line | Line endings |
(group) | Capture for $1 in replacement | Extracted substring |
Why it matters: A small pattern library covers most paste-cleanup tasks without writing custom scripts.
Common mistake: Using . expecting a literal period — in regex, . matches any single character except newline.
Practical Regex Replacements
These patterns cover common bulk find and replace tasks on pasted text. Enable regular expression mode for each.
| Task | Find (regex) | Replace |
|---|---|---|
| Remove all digits | \d+ | (empty) |
| Collapse extra spaces | {2,} | (single space) |
| Strip HTML tags | <[^>]+> | (empty) |
| Swap two words | (\w+) (\w+) | $2 $1 |
Why it matters: One pattern can fix hundreds of varied matches — digits, tags, or name pairs — that plain text cannot reach with a single find string.
Edge case: Run on a short sample first; check the replacement count and diff before processing a long paste.
Common Find and Replace Use Cases
Find and replace online suits one-buffer edits — pasted articles, CSV snippets, config excerpts, or email exports — where opening an IDE is slower than a browser tab.
Fix repeated typos
A misspelled proper noun copied twelve times across a draft becomes one find-and-replace pass.
Example: Find Antrhopic, replace Anthropic — check the replacement count matches your expectation.
Rename tokens or placeholders
Developers and writers swap identifiers or merge-field placeholders across a sample without a project-wide refactor.
Example: Find [CLIENT_NAME], replace Acme Corp in a proposal template.
Edge case: Enable whole words only when renaming short tokens like id that appear inside longer words.
Clean exported data
Spreadsheet or database exports often need delimiter or placeholder normalization before import.
Example: Regex find ;\s*, replace , to turn semicolon-separated values into comma-separated text.
Delete Text With an Empty Replacement
Leaving the replace with field empty deletes every match — the find string is removed and nothing is inserted.
Why it matters: Deletion is the same operation as replace-with-blank; no separate “delete mode” exists.
Example: Find (draft) with an empty replacement strips that suffix from every line.
Common mistake: Accidentally leaving replace empty when you meant to substitute — review the diff panel before copying the result elsewhere.
Review Changes With the Text Diff Panel
After a replacement runs, check the replacement count first, then read the change diff — it highlights what was added and removed compared to the text before that operation.
Why it matters: A count of zero means no match; a count far above your estimate signals over-matching. The diff confirms which characters actually changed before you copy the result elsewhere.
Example: Replacing color with colour shows each swapped word in context — catch accidental hits inside URLs or code tokens.
Edge case: The diff reflects the last replacement on the current editor contents. For comparing two independent drafts side by side, use the Compare Text tool instead.
Find and Replace vs Compare Text
Find and replace edits one body of text in place — search, substitute, review. Compare Text shows two separate inputs and highlights differences between them without performing substitutions.
Why it matters: Use find and replace when you know what to change. Use compare when you need to audit how two versions differ before deciding what to edit.
Example: Normalize a contract clause with find and replace, then compare the revised paste against the original in Compare Text for a final review.
Common mistake: Pasting version A and version B into find and replace — that tool modifies one string; it does not diff two documents.
Common Find and Replace Mistakes
- Partial-word matches —
catinsidecategorywithout whole-word mode enabled. - Smart quotes — Word and web paste use curly quotes
“”; searching for straight"finds zero matches. - Wrong case mode —
APIwill not matchapiwhen match case is on. - Regex special characters —
$,.,(behave as pattern syntax in regex mode. - Ignoring the count — zero matches means the find string is not in the text (or options exclude it); an unexpectedly high count signals over-matching.
- Invisible characters — zero-width spaces from PDF or web paste break literal matches; see the Invisible Character tool to diagnose.
- Greedy regex —
.*matches as much as possible; use.*?for the shortest match when patterns span multiple words.
Why it matters: These errors produce silent wrong output — spell-check passes because every word is spelled correctly after a bad substitution.
Limitations of This Find and Replace Tool
Automated find and replace applies pattern rules to a single editor buffer. It does not understand document structure, formatting, or file systems.
- No undo stack — each run overwrites the editor; copy intermediate results if you chain several passes.
- No file upload — paste text directly; very large logs may be slow in the browser.
- No match-by-match navigation before replace — verify with replacement count and the diff panel.
- Regex flags — uses JavaScript global (
g) and optional ignore-case (i); no separate multiline toggle —.does not match newlines by default. - Whole words + regex — when regex mode is on, the whole-word option is ignored; use
\bin the pattern instead.
Chaining multiple passes
Complex cleanups are often easier as several small find-and-replace steps than one large regex.
Why it matters: Each pass is easier to verify — copy the result after a step you trust before running the next substitution.
Example: First replace N/A with blank cells, then normalize colour to color — two short runs instead of one fragile regex.
Edge case: Multi-file refactors across a codebase belong in VS Code or sed — this page targets single-paste bulk edits.
Reference: MDN — Regular expressions in JavaScript (external).
Frequently Asked Questions
What is find and replace?
A tool that searches text for a string or pattern and substitutes a replacement for each match — the same operation as Ctrl+H in desktop editors.
What is a text replacer?
Another name for find and replace — locate text, insert a substitute, repeat for every match.
What is case-sensitive find and replace?
With match case enabled, Foo and foo are different strings. With match case off, the search ignores capitalization.
What is whole word matching?
Whole-word mode matches standalone words only — cat will not match inside category or scatter.
Replace all vs first occurrence only?
By default every match is replaced. Enable replace only the first occurrence to change a single instance — useful for testing before a full run.
How do I delete text with find and replace?
Leave the replacement field empty. Every match of the find string is removed with nothing inserted.
What is regex find and replace?
Regex mode interprets the find field as a JavaScript regular expression — patterns like \d+ match digits instead of a fixed literal string.
What are capture groups $1 and $2?
In regex mode, parentheses capture matched text. $1 in the replacement inserts the first group, $2 the second.
When should I use regex vs plain text?
Use plain text for literal phrases and fixed typos. Use regex when you need digits, flexible spacing, or capture groups.
How do I replace a word throughout a document?
Enter the word in Find, the new text in Replace, enable whole words only if short tokens might appear inside longer words, then run replace.
How do I fix a repeated typo?
Find the misspelling, enter the correct spelling as replacement, leave match case off to catch variant capitals. Confirm the replacement count.
Can I replace line breaks?
Yes. In plain mode paste the actual line break into the find field, or in regex mode use \n for newline characters.
Why are there zero matches?
The find string is not in the text, case sensitivity excludes it, whole-word mode narrows too far, or smart quotes differ from your search characters.
Why did it replace inside other words?
Substring mode matches any occurrence. Enable whole words only or use regex word boundaries (\b) for word-level replacements.
Why do smart quotes not match?
Curly quotes from Word or the web are different Unicode characters from straight quotes. Copy a quote from your text into the find field or normalize quotes first.
Find and replace vs Compare Text — which should I use?
Use find and replace to edit one paste. Use Compare Text to highlight differences between two separate versions without substituting.
How is this different from Word Ctrl+H?
Word Ctrl+H edits inside a .docx with formatting awareness. This browser tool works on plain pasted text — faster for snippets, exports, and code samples without opening Word.
What does the replacement count mean?
It shows how many matches were substituted in the last operation. Compare it to your expectation before copying the result.
What is the change diff view?
After replace, a diff panel highlights additions and deletions compared to the text before that run — a quick sanity check on the same document.
Does this tool support regular expressions?
Yes. Enable regular expression mode for JavaScript regex patterns and $1 backreferences in the replacement field.
Is my text uploaded to a server?
No. Find and replace runs in your browser. Text stays on your device.
Is this find and replace tool free?
Yes. TextTools find and replace is free with no sign-up required.