Skip to Content

Find & Replace

A powerful tool for text search and batch replacement. Supports case sensitivity, whole word matching, and regular expressions.

How to Use

  • Enter text in the input area
  • Enter the text you want to find
  • Enter the replacement text
  • Select options: Case Sensitive, Whole Word, Regular Expression
  • Click Replace All to change all matches

Regular Expression Examples

  • \d+ - Find numbers
  • \w+@\w+\.\w+ - Find email addresses
  • https?://\S+ - Find URLs
  • \s+ - Find whitespace

Key Features

🔍 Flexible Search Options

  • Case Sensitive: Distinguish between uppercase and lowercase letters
  • Whole Word: Match complete words only
  • Regular Expression: Use powerful regex patterns for complex searches

⚡ Batch Processing

  • Replace all matches at once
  • Real-time match count display
  • Preview results before replacing

💡 Multiple Use Cases

  • Code refactoring
  • Documentation updates
  • Data cleaning
  • Text formatting

Usage Examples

Basic Text Replacement

Replace simple text strings:

Input: Hello World, Hello Everyone
Find: Hello
Replace: Hi
Result: Hi World, Hi Everyone

Distinguish between different cases:

Input: Apple apple APPLE
Find: apple (Case Sensitive ON)
Replace: orange
Result: Apple orange APPLE

Whole Word Matching

Match complete words only:

Input: cat catch category
Find: cat (Whole Word ON)
Replace: dog
Result: dog catch category

Regular Expression Examples

1. Find Numbers

Pattern: \d+
Matches: 123, 456, 789 in "abc123def456ghi789"

2. Find Email Addresses

Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Matches: user@example.com, admin@site.org

3. Find URLs

Pattern: https?://[^\s]+
Matches: https://example.com, http://site.org

4. Find Whitespace

Pattern: \s+
Matches: All spaces, tabs, and line breaks

Programming Language Examples

JavaScript

// Using String.replace() method
const text = "Hello World";
const result = text.replace("Hello", "Hi");
console.log(result); // "Hi World"

// Using regex for case-insensitive replacement
const regexResult = text.replace(/hello/i, "Hi");
console.log(regexResult); // "Hi World"

// Replace all occurrences
const multiReplace = "cat cat cat".replace(/cat/g, "dog");
console.log(multiReplace); // "dog dog dog"

Python

# Using str.replace() method
text = "Hello World"
result = text.replace("Hello", "Hi")
print(result) # "Hi World"

# Using re.sub() for regex replacement
import re
regex_result = re.sub(r'hello', 'Hi', text, flags=re.IGNORECASE)
print(regex_result) # "Hi World"

# Replace all occurrences
multi_replace = re.sub(r'cat', 'dog', 'cat cat cat')
print(multi_replace) # "dog dog dog"

Java

// Using String.replace() method
String text = "Hello World";
String result = text.replace("Hello", "Hi");
System.out.println(result); // "Hi World"

// Using regex with replaceAll()
String regexResult = text.replaceAll("(?i)hello", "Hi");
System.out.println(regexResult); // "Hi World"

// Replace all occurrences
String multiReplace = "cat cat cat".replaceAll("cat", "dog");
System.out.println(multiReplace); // "dog dog dog"

Best Practices

1. Test Before Replacing

Always preview the number of matches before performing the replacement to avoid unintended changes.

2. Use Appropriate Options

  • Use Case Sensitive when you need to preserve case distinctions
  • Use Whole Word to avoid partial matches
  • Use Regular Expression for complex pattern matching

3. Backup Important Data

For large-scale replacements, keep a backup of your original text.

4. Understand Regex Patterns

When using regular expressions:

  • Test patterns thoroughly
  • Use online regex testers for validation
  • Be aware of special characters that need escaping

5. Common Regex Patterns

Numbers:        \d+ or [0-9]+
Letters: [a-zA-Z]+
Alphanumeric: \w+ or [a-zA-Z0-9_]+
Whitespace: \s+
Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
URL: https?://[^\s]+
Phone: \d{3}-\d{3}-\d{4}

FAQ

Q: What's the difference between normal and regex search? A: Normal search finds exact text matches, while regex allows pattern-based searching with wildcards, character classes, and quantifiers.

Q: How do I escape special characters in regex? A: Use a backslash before special characters: \. \* \+ \? \[ \] \( \) \{ \} \^ \$ \| \\

Q: Can I replace line breaks? A: Yes, use regex with the pattern \n to find line breaks, or \r\n for Windows-style line endings.

Q: Why isn't my regex working? A: Common issues include:

  • Forgetting to enable the "Regular Expression" option
  • Not escaping special characters
  • Using incorrect flag syntax

Q: How can I replace with captured groups? A: Use $1, $2, etc. in the replace field to reference captured groups from your regex pattern:

Find: (\d+)-(\d+)
Replace: $2-$1
"123-456" becomes "456-123"