Find & Replace
Find and replace text with regex support.
How to Use the Find and Replace Tool
The Find and Replace tool is a powerful text editing utility that lets you search for specific text patterns and substitute them with new content. It supports plain text matching, whole-word matching, case-sensitive searches, and even full regular expressions for advanced users.
Basic Usage
Enter the text you want to find in the "Find" field and the replacement text in the "Replace with" field. Paste your document into the main text area, then click Replace All to replace every occurrence at once, or Replace Next to step through matches one by one. The output appears in the read-only area below, and a counter shows how many replacements were made.
Options Explained
- Case-sensitive: When enabled, "Hello" and "hello" are treated differently. Off by default, so matches are case-insensitive unless you enable this.
- Whole word only: Only matches the search term when it appears as a complete word (surrounded by word boundaries). For example, searching for "cat" with whole word enabled would match "cat" but not "catch" or "scat".
- Use regex: Treats the Find field as a JavaScript regular expression. This unlocks powerful pattern matching โ for example,
\d+matches any number,[aeiou]matches any vowel, and\bword\bmatches whole words.
Regex Examples
- Find
\d{4}-\d{2}-\d{2}to match dates in YYYY-MM-DD format - Find
\b[A-Z][a-z]+\bto match capitalized words - Find
https?://\S+to match URLs - Find
\s+and replace with a single space to collapse multiple spaces
Leaving Replace Empty
If you leave the "Replace with" field empty, matched text will simply be deleted. This is useful for quickly removing specific words, tags, or patterns from your text without a replacement.
Related Tools
Frequently Asked Questions
What does "Replace Next" do differently from "Replace All"?
Replace Next replaces only the first occurrence of the search term that hasn't been replaced yet, and shows the count incrementing one at a time. This is useful when you want to review each match before replacing it. Replace All substitutes every single match in one operation, which is faster but less controlled.
My regex keeps showing an error โ what's wrong?
Common regex errors include unmatched parentheses, unclosed brackets, or invalid escape sequences. If you get an error, check that all opening brackets and parentheses have a matching closing pair. Also note that in the Find field you do not include the surrounding slashes (/) that you would in JavaScript code โ just the pattern itself. The tool automatically compiles it as a regex with the global flag.
Can I use capture groups in regex replacement?
Yes! When Regex mode is enabled, you can use $1, $2, etc. in the Replace field to reference capture groups. For example, if you find (\w+)\s(\w+) (two words), you can replace with $2 $1 to swap the word order. This is a very powerful feature for restructuring text.
How do I replace line breaks?
Enable the "Use regex" option and enter \n in the Find field to match newline characters. You can replace all line breaks with a space by replacing \n with a space, or replace double line breaks (paragraph breaks) by replacing \n\n (or \n\s*\n) with your desired separator.
Is my text private?
Yes. All text processing happens entirely within your browser. Nothing is sent to any server. Your text never leaves your device, making this tool safe for confidential documents, source code, and sensitive data.