Find and Replace
Search and replace text with advanced options. Support for case sensitivity, whole word matching, and regular expressions for powerful text transformations.
Text ToolsHow to Use Find and Replace
How to Use Find and Replace
Quick Start Guide
-
Enter Search Text: Type what you want to find
- Enter text in the "Find" field
- Can be a word, phrase, or pattern
- Works with any text content
- Real-time match counter updates
-
Enter Replacement Text: Type your replacement
- Enter text in the "Replace with" field
- Can be empty to delete matches
- Can be longer or shorter than original
- Supports special characters
-
Configure Search Options: Choose your settings
- Case Sensitive: Match exact capitalization
- Whole Word: Match complete words only
- Use Regex: Enable pattern matching
- Options work together or independently
-
Paste Your Text: Add content to transform
- Paste into the input textarea
- See match count update live
- Orange highlight shows matches found
- No length limits (browser memory)
-
Replace All: Click to transform
- Processes instantly
- Shows count of replacements made
- Displays transformed text in output
- Copy or use immediately
Understanding Find and Replace
What is Find and Replace?
Definition:
- Search for specific text patterns in your content
- Replace all occurrences with new text
- Transform text in bulk with one click
- Essential editing tool for text processing
How It Works:
- Scan through entire text
- Find all matches of search pattern
- Replace each match with replacement text
- Return transformed result
Use Cases:
- Update variable names in code
- Fix spelling errors in bulk
- Change product names in documents
- Remove or mask sensitive information
- Standardize terminology across text
Search Options Explained
Case Sensitive
Disabled (Default):
Find: "hello"
Matches: "hello", "Hello", "HELLO", "HeLLo"
Enabled:
Find: "hello"
Matches: "hello" only
Does NOT match: "Hello", "HELLO", "HeLLo"
When to Use:
- Disabled: General text editing, fixing typos
- Enabled: Code editing, preserving proper nouns, exact matches
Whole Word
Disabled (Default):
Find: "cat"
Matches: "cat", "catch", "category", "concatenate"
Enabled:
Find: "cat"
Matches: "cat" only (as complete word)
Does NOT match: "catch", "category", "concatenate"
How It Works: Uses word boundaries (\b) to ensure matches are surrounded by non-word characters (spaces, punctuation, start/end of line).
When to Use:
- Disabled: Finding partial matches, flexible search
- Enabled: Replacing specific words without affecting similar words
Use Regex
Disabled (Default): Literal text search. Special characters like ., *, + are treated as plain text.
Enabled: Pattern matching with regular expressions.
Examples:
\\d+ = Match any number (123, 456, 7890)
\\w+@\\w+\\.\\w+ = Match email patterns
\\b[A-Z]{2,}\\b = Match uppercase abbreviations
When to Use:
- Disabled: Simple text replacement, no patterns needed
- Enabled: Complex patterns, emails, URLs, formatted data
Match Counter
Real-Time Updates:
- Shows number of matches found
- Updates as you type in "Find" field
- Updates when you change options
- Orange color indicates matches to replace
Why It Matters:
- Preview before replacing
- Verify search pattern correctness
- Avoid unexpected replacements
- Confidence in operation
Common Use Cases
1. Fix Spelling Mistakes in Bulk
Problem: Misspelled word appears many times throughout document.
Solution:
Find: "teh"
Replace: "the"
Options: Case insensitive, NOT whole word
Before:
Teh quick brown fox jumps over teh lazy dog.
Teh fox is quick and teh dog is lazy.
After:
The quick brown fox jumps over the lazy dog.
The fox is quick and the dog is lazy.
2. Update Variable Names in Code
Problem: Need to rename variable across code snippet.
Solution:
Find: "oldVariableName"
Replace: "newVariableName"
Options: Case sensitive, Whole word
Before:
let oldVariableName = 10;
function test(oldVariableName) {
console.log(oldVariableName);
}
After:
let newVariableName = 10;
function test(newVariableName) {
console.log(newVariableName);
}
Why Whole Word? Prevents replacing "oldVariableNameExtended" accidentally.
3. Change Product Name Across Document
Problem: Product rebranding requires name change in all marketing copy.
Solution:
Find: "ProductX"
Replace: "ProductPro"
Options: Case sensitive
Before:
ProductX is the best tool. Get ProductX today!
Why choose ProductX? ProductX delivers results.
After:
ProductPro is the best tool. Get ProductPro today!
Why choose ProductPro? ProductPro delivers results.
4. Remove or Mask Sensitive Information
Problem: Need to redact email addresses from document before sharing.
Solution (with Regex):
Find: \\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b
Replace: [EMAIL REMOVED]
Options: Use Regex
Before:
Contact john@email.com or jane@example.org for help.
Send reports to admin@company.net.
After:
Contact [EMAIL REMOVED] or [EMAIL REMOVED] for help.
Send reports to [EMAIL REMOVED].
5. Standardize Terminology
Problem: Document uses inconsistent terminology.
Solution:
Find: "e-mail"
Replace: "email"
Options: Case insensitive
Before:
Send an e-mail to our team. E-mail support is available.
Your E-mail will be answered within 24 hours.
After:
Send an email to our team. Email support is available.
Your email will be answered within 24 hours.
6. Format Phone Numbers
Problem: Phone numbers in different formats need standardization.
Solution (with Regex):
Find: (\\d{3})-(\\d{3})-(\\d{4})
Replace: ($1) $2-$3
Options: Use Regex
Before:
Call 555-123-4567 or 555-987-6543
After:
Call (555) 123-4567 or (555) 987-6543
7. Delete All Instances
Problem: Want to remove certain word entirely.
Solution:
Find: "DRAFT"
Replace: (leave empty)
Options: Case sensitive
Before:
DRAFT This is a DRAFT document DRAFT
Please review this DRAFT version
After:
This is a document
Please review this version
Note: May create extra spaces - use with Trailing Space Remover after.
Regular Expression Patterns
Common Regex Patterns
Email Addresses:
\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b
Phone Numbers (US):
\\(?\\d{3}\\)?[-.]?\\d{3}[-.]?\\d{4}
URLs:
https?://[^\\s]+
Numbers:
\\d+ # Any integer
\\d+\\.\\d+ # Decimal numbers
Dates (MM/DD/YYYY):
\\d{1,2}/\\d{1,2}/\\d{4}
Hexadecimal Colors:
#[A-Fa-f0-9]{6}
Whitespace:
\\s+ # One or more spaces, tabs, newlines
^\\s+ # Leading whitespace
\\s+$ # Trailing whitespace
Word Boundaries:
\\b # Word boundary
\\bword\\b # Exact word match
Regex Special Characters
Character Classes:
\\d= Digit (0-9)\\w= Word character (a-z, A-Z, 0-9, _)\\s= Whitespace (space, tab, newline).= Any character
Quantifiers:
*= Zero or more+= One or more?= Zero or one{n}= Exactly n times{n,}= n or more times{n,m}= Between n and m times
Anchors:
^= Start of line$= End of line\\b= Word boundary
Groups:
()= Capture group(?:)= Non-capturing group|= OR operator
Regex Replacement Patterns
Capture Groups:
Find: (\\d{3})-(\\d{3})-(\\d{4})
Replace: ($1) $2-$3
Result: 555-123-4567 → (555) 123-4567
Swap Parts:
Find: (\\w+), (\\w+)
Replace: $2 $1
Result: "Doe, John" → "John Doe"
Features
Real-Time Match Counter
Live Updates:
- Shows matches as you type
- Updates with option changes
- Visible before replacing
- Prevents surprises
Benefits:
- Verify pattern works
- See scope of changes
- Adjust before committing
- Confidence in results
Smart Word Boundary Detection
Whole Word Option:
- Uses regex
\\bboundaries - Matches complete words only
- Ignores partial matches
- Precise replacements
Example:
Find: "test" (Whole Word enabled)
Matches: "test"
Ignores: "testing", "contest", "attest"
Case Sensitivity Control
Flexible Matching:
- Case insensitive: broader matches
- Case sensitive: exact matches
- Choose based on need
- Works with all options
Regex Power
Advanced Patterns:
- Email addresses
- Phone numbers
- URLs and links
- Custom patterns
- Capture groups
Safe Mode:
- Validates regex syntax
- Shows error if invalid
- Prevents crashes
- Clear error messages
Statistics Tracking
Input Stats:
- Total characters
- Word count
- Line count
- Match count (orange highlight)
Output Stats:
- Updated counts
- Replacements made
- Changed metrics
- Verification data
Technical Details
String Replacement Algorithm
Process:
- Pattern Creation: Build regex from find text and options
- Escaping: Escape special chars if not using regex mode
- Flags: Add global (g) and case-insensitive (i) flags
- Matching: Count matches with
.match() - Replacement: Use
.replace()with pattern - Validation: Catch and report regex errors
Time Complexity:
- O(n) where n = text length
- Linear scanning
- Efficient for large texts
Option Combinations
Case Sensitive + Whole Word:
new RegExp(`\\\\b${escaped}\\\\b`, 'g') // Case sensitive
new RegExp(`\\\\b${escaped}\\\\b`, 'gi') // Case insensitive
Regex Mode:
new RegExp(findText, flags) // User provides pattern
Literal Mode:
const escaped = findText.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')
new RegExp(escaped, flags)
Error Handling
Invalid Regex:
Try-catch around regex creation
User-friendly error message
Output cleared on error
No crash or hang
Empty Find:
Shows error toast
Prevents replacement
Prompts user to enter text
No operation performed
Best Practices
Before Replacing
Check These:
- ✅ Match counter shows expected number
- ✅ Search pattern is correct
- ✅ Options configured properly
- ✅ Replacement text is what you want
- ✅ Preview input carefully
Choosing Options
Case Sensitive:
- ✅ Use for code, proper nouns, exact matches
- ❌ Skip for general text, fixing typos
Whole Word:
- ✅ Use when replacing specific words
- ❌ Skip when finding partial matches
- ⚠️ Disabled automatically with regex mode
Use Regex:
- ✅ Use for patterns, emails, phone numbers
- ❌ Skip for simple literal text
- ⚠️ Validate pattern before replacing
Regex Tips
Start Simple:
\\d+ # Match numbers first
[a-z]+ # Then add complexity
\\w+@\\w+ # Build patterns step-by-step
Test Patterns:
- Check match counter
- Verify expected matches
- Adjust pattern as needed
- Use regex testing tools online
Escape Special Chars:
. → \\.
* → \\*
+ → \\+
? → \\?
( → \\(
) → \\)
Common Mistakes:
- Forgetting to escape dots in domains
- Using
*instead of+(matches empty) - Not using word boundaries when needed
- Overly greedy patterns (use
?for non-greedy)
Multiple Replacements
Sequential Operations:
- First replacement
- Copy output
- Paste as new input
- Second replacement
- Repeat as needed
Alternative: Use regex with OR operator:
Find: (word1|word2|word3)
Replace: newword
Comparison with Similar Tools
vs. Text Editor Find/Replace
This Tool:
- ✅ Web-based, no installation
- ✅ See all matches before replacing
- ✅ Real-time match counter
- ✅ Copy output easily
Text Editor:
- ✅ Works offline always
- ✅ Direct file editing
- ✅ Undo support
- ✅ Multi-file search
vs. Command-Line Tools (sed, awk)
This Tool:
- ✅ Visual interface
- ✅ No syntax to learn
- ✅ Instant preview
- ✅ Accessible to non-developers
CLI Tools:
- ✅ Automation scripts
- ✅ Batch file processing
- ✅ Pipeline integration
- ✅ More powerful for bulk ops
vs. Word Processor Find/Replace
This Tool:
- ✅ Plain text focus
- ✅ Regex support
- ✅ Developer-friendly
- ✅ Fast processing
Word Processor:
- ✅ Formatted text support
- ✅ Replace formatting
- ✅ Track changes
- ✅ Document-specific features
Limitations
What This Tool Does NOT Do
❌ Multiple Find/Replace in One Go
- Only one find/replace operation at a time
- Need to run multiple times for different replacements
- Workaround: Use regex OR patterns
❌ Preview Individual Matches
- Shows total count only
- No highlighting in text
- No match-by-match review
- Replace all at once
❌ Undo Operation
- No undo after replacement
- Keep original in input field
- Copy input before replacing
- Manual reversal if needed
❌ File Operations
- No direct file editing
- Copy-paste workflow
- No save to file
- Browser-based only
❌ Advanced Regex Features
- No lookahead/lookbehind (browser limit)
- No named groups in replacement
- Basic capture groups only
- Standard JavaScript regex
Troubleshooting
No Matches Found
Possible Reasons:
- Search text not in input
- Case sensitivity issue
- Whole word preventing match
- Regex pattern incorrect
Solutions:
- Check spelling in find field
- Try disabling case sensitive
- Disable whole word option
- Validate regex pattern
Too Many Matches
Why:
- Search text too general
- Case insensitive matching too broad
- Not using whole word option
Solutions:
- Make search more specific
- Enable case sensitive
- Enable whole word
- Use regex for precise pattern
Invalid Regex Error
Common Mistakes:
[abc # Missing closing bracket
(abc # Missing closing paren
\\ # Trailing backslash
*abc # Nothing to repeat
Solutions:
- Check all brackets closed
- Escape special characters
- Validate pattern online
- Use literal mode instead
Unexpected Replacements
Why:
- Partial word matches
- Case mismatches
- Regex matching more than expected
Solutions:
- Enable whole word
- Enable case sensitive
- Test pattern with match counter
- Adjust regex pattern
Output Looks Wrong
Check:
- Replacement text correct
- Options configured right
- All matches intended
- Regex groups correct
Fix:
- Adjust replacement text
- Change options
- Refine search pattern
- Clear and retry
Performance
Processing Speed
Typical Performance:
- 1,000 words: < 5ms
- 10,000 words: < 20ms
- 100,000 words: < 100ms
Factors:
- Text length
- Pattern complexity
- Match count
- Browser performance
Large Text Handling
Optimized:
- Single-pass algorithm
- Efficient regex engine
- Minimal memory overhead
- Browser-optimized code
Limits:
- Millions of characters supported
- Limited by browser memory
- No artificial restrictions
Browser Compatibility
✅ Chrome 90+ ✅ Firefox 88+ ✅ Safari 14+ ✅ Edge 90+ ✅ Opera 76+
Required:
- ES6 JavaScript
- Regex support
- String methods
- Clipboard API
Privacy & Security
Client-Side Processing
Guaranteed:
- ✅ No server uploads
- ✅ No data transmission
- ✅ No storage
- ✅ No tracking
Safe For:
- Confidential documents
- Source code
- Personal information
- Sensitive data
Offline Use
Works completely offline after initial page load.
Quick Reference
Basic Usage
- Enter find text
- Enter replace text
- Paste content
- Click "Replace All"
- Copy output
Option Quick Guide
| Option | Effect | Use When |
|---|---|---|
| Case Sensitive | Exact case match | Code, proper nouns |
| Whole Word | Complete words only | Avoiding partial matches |
| Use Regex | Pattern matching | Emails, URLs, complex patterns |
Common Patterns
\\d+ Numbers
\\w+ Words
\\s+ Whitespace
\\b\\w+@\\w+\\.\\w+\\b Emails (simple)
https?://[^\\s]+ URLs
Frequently Asked Questions
Related Utility Tools
Temperature Converter
FeaturedConvert temperatures between Celsius, Fahrenheit, and Kelvin instantly with live conversion
Use Tool →Unit Converter
FeaturedConvert between length, weight, and volume units instantly. Support for metric and imperial systems.
Use Tool →Word Counter
FeaturedCount words, characters, sentences, and reading time instantly
Use Tool →Area Converter
FeaturedConvert areas between square feet, square meters, acres, hectares, and square yards instantly
Use Tool →Time Zone Converter
FeaturedConvert between time zones and see current or custom time across different parts of the world
Use Tool →Speed Converter
FeaturedConvert speeds between miles per hour (MPH), kilometers per hour (KPH), and knots instantly
Use Tool →Minify JavaScript
Minify and compress JavaScript code to reduce file size for production. Remove comments, whitespace, and optimize code for faster loading.
Use Tool →Paper Size Converter
Convert between international paper sizes (A4, Letter, Legal) with dimensions in mm, cm, and inches. Compare ISO A/B series and North American paper standards.
Use Tool →Share Your Feedback
Help us improve this tool by sharing your experience