Find and Replace Text Online — Fast & Free
Find and replace is one of the most powerful text editing operations available — turning a task that would take minutes of manual work into a single click. Whether you need to rename a variable across hundreds of lines, reformat dates, or fix a repeated typo throughout a document, understanding find and replace saves significant time. This guide covers everything from basic substitution to regex-powered replacements.
What Is Find and Replace?
Find and replace (sometimes called search and replace) scans a body of text for every occurrence of a target string and substitutes it with a replacement string. It is available in virtually every text editor, code editor, word processor, and spreadsheet application. The basic version is straightforward: type what to find, type the replacement, and click Replace All.
More advanced implementations support regular expressions (patterns instead of literal strings), case-sensitive matching, whole-word matching, and capture groups that let you reuse parts of the found text in the replacement.
Keyboard Shortcuts for Find & Replace
| Platform | Find | Find & Replace |
|---|---|---|
| Windows / Linux | Ctrl+F | Ctrl+H |
| macOS | Cmd+F | Cmd+Option+F |
| VS Code | Ctrl+F | Ctrl+H (file) / Ctrl+Shift+H (project) |
| Google Docs | Ctrl+F | Ctrl+H |
| Microsoft Word | Ctrl+F | Ctrl+H |
Case-Sensitive vs Case-Insensitive Matching
By default, many find-and-replace tools are case-insensitive — searching for "apple" also matches "Apple" and "APPLE". When you need precision — for example, replacing a variable name without touching a class name of the same letters in different case — enable case-sensitive mode. The ToolsBox Find & Replace tool includes a toggle for this.
Whole-Word Matching
Whole-word matching ensures the search string is surrounded by non-word characters (spaces, punctuation, line breaks). If you search for cat with whole-word on, it will match cat in a sentence but not cats, concatenate, or scatter. This prevents accidental partial-word replacements when renaming identifiers in code.
Using Regular Expressions in Find & Replace
Regular expressions (regex) transform find-and-replace from a simple text swap into a powerful transformation engine. Here are practical examples:
| Pattern | Replacement | What It Does |
|---|---|---|
\b(\w+)\s+\1\b | $1 | Remove duplicate consecutive words |
(\d{4})-(\d{2})-(\d{2}) | $3/$2/$1 | Reformat date YYYY-MM-DD → DD/MM/YYYY |
https?://\S+ | [link] | Replace all URLs with placeholder |
^\s+ | (empty) | Remove leading whitespace from each line |
Use our Regex Tester to test your patterns before running a bulk replacement.
Practical Use Cases
- Rename a variable across a codebase — change
userIDtouserIdeverywhere with whole-word and case-sensitive on. - Fix repeated typos — replace all instances of "teh" with "the" in a long document.
- Reformat data — change date formats, phone number styles, or address formats using regex capture groups.
- Strip HTML tags — use the pattern
<[^>]+>to remove all HTML tags from pasted content. - Normalise whitespace — replace multiple spaces with a single space using
[ ]{2,}.
Try Find & Replace free — no signup
Supports regex, case-sensitive and whole-word matching. Results are instant.Frequently Asked Questions
What is find and replace?
Find and replace scans text for a target string and substitutes it with a replacement. It supports options like case sensitivity, whole-word matching, and regular expressions for complex pattern-based replacements.
What does 'match whole word' mean?
Whole-word matching requires the search term to appear as a complete word surrounded by non-word characters. Searching for 'cat' with whole-word enabled finds 'cat' but not 'cats', 'concatenate' or 'scatter'.
Can I use regex in find and replace?
Yes. Enable regex mode to use patterns like \d+ for digits or capture groups with parentheses. This lets you reformat dates, extract structured data, or make complex substitutions that simple text matching cannot handle.
How do I replace all occurrences at once?
Click Replace All in the tool, or use Ctrl+H (Windows) / Cmd+Option+F (Mac) in your editor. The ToolsBox Find & Replace tool replaces every matching instance in one click.
← Back to Blog | Related tool: Find & Replace