Find & Replace Tool
Advanced find and replace tool with regex support, batch operations, live preview, and comprehensive text manipulation features
Input Text
Result (read-only)
Keyboard Shortcuts
Complete Guide to the Find & Replace Tool
Master text manipulation with this comprehensive find and replace tool that offers advanced features for precise text editing.
What is the Find & Replace Tool?
The Find & Replace Tool is an advanced text manipulation application designed for writers, developers, editors, and data professionals who need sophisticated text processing capabilities. Built with Svelte 5 and modern web technologies, this tool provides real-time text transformation with extensive customization options.
Core Features & Capabilities
Basic Find & Replace
- Real-time search and replace functionality
- Case-sensitive and case-insensitive matching
- Whole word matching for precise replacements
- Regular expression support for complex patterns
- Replace first occurrence or all occurrences
- Live preview with highlighted matches
Advanced Features
- Batch operations for multiple find/replace rules
- Undo/redo functionality with full history
- Pattern replacements with variables
- Text transformations (uppercase, lowercase, title case)
- Export results to Excel
- Keyboard shortcuts for efficiency
How to Use the Find & Replace Tool
Step 1: Input Your Text
Paste or type your text into the input area. The tool processes text in real-time and provides immediate feedback.
Step 2: Configure Search Options
Enter the text you want to find and the replacement text. Choose from these options:
- Case Sensitive: Match exact capitalization
- Whole Word: Match complete words only
- Regular Expression: Use regex patterns for complex matching
- Highlight Matches: Visually highlight found text
Step 3: Perform Replacements
Use the action buttons to execute replacements:
- Replace: Replace the next occurrence
- Replace All: Replace all occurrences at once
- Undo/Redo: Navigate through your edit history
Step 4: Use Advanced Features
Switch between tabs to access advanced functionality:
- Batch Tab: Set up multiple find/replace operations
- Advanced Tab: Use pattern replacements and text transformations
Regular Expression Support
The tool supports powerful regular expressions for complex text manipulation:
Basic Patterns
- ^- Start of line
- $- End of line
- .- Any character
- *- Zero or more of previous character
- +- One or more of previous character
- ?- Zero or one of previous character
Character Classes
- \\d- Any digit
- \\w- Any word character
- \\s- Any whitespace
- [abc]- Any of the characters a, b, or c
- [^abc]- Any character except a, b, or c
Examples
Find: \\b\\d3-\\d2-\\d4\\b
Replace: XXX-XX-XXXX
// Replaces Social Security numbers with masked versionFind: (\\w+)@(\\w+\\.\\w+)
Replace: [EMAIL PROTECTED]
// Replaces email addressesBatch Operations
The Batch tab allows you to set up multiple find/replace operations:
- Click "Add Operation" to create a new rule
- Enter find and replace text for each operation
- Enable or disable individual operations
- Click "Apply Batch Operations" to execute all enabled rules
Pattern Replacements
Pattern Replacements allow you to insert dynamic content into your replacement text using special variables. These variables are processed during the actual replacement operation, making them perfect for creating sequential numbers, timestamps, or unique identifiers.
Available Pattern Variables
- $counter- Insert incremental numbers (1, 2, 3...)
- $date- Insert current date
- $time- Insert current time
- $uuid- Insert random UUID
How to Use Pattern Replacements
- Access Advanced Tab: Click the "Advanced" tab in the main controls
- Insert Variables: Click any pattern button (Counter, Date, Time, UUID) to add it to your replacement field
- Configure Find Pattern: Enter the text or regex pattern you want to match
- Execute Replacement: Click "Replace All" to process all matches with dynamic content
Detailed Examples
1. Creating Numbered Lists with $counter
Use Case: Convert a list of items into numbered tasks
Input Text:
Item one
Item two
Item three
Item fourConfiguration:
- Find: Item (.*)(with regex enabled)
- Replace: Task $counter: $1
Result:
Task 1: one
Task 2: two
Task 3: three
Task 4: four2. Adding Timestamps with $date and $time
Use Case: Add creation timestamps to log entries
Input Text:
ERROR: Connection failed
WARNING: Low memory
INFO: Process startedConfiguration:
- Find: ^(.*)$(with regex enabled - matches entire lines)
- Replace: $1 - $date $time
Result:
ERROR: Connection failed - 10/25/2024 2:30:15 PM
WARNING: Low memory - 10/25/2024 2:30:15 PM
INFO: Process started - 10/25/2024 2:30:15 PM3. Generating Unique IDs with $uuid
Use Case: Add unique identifiers to data records
Input Text:
John Doe, Engineer
Jane Smith, Manager
Bob Johnson, AnalystConfiguration:
- Find: ^(.*)$(with regex enabled)
- Replace: $uuid,$1
Result:
a1b2c3d4-e5f6-7g8h-9i0j-1k2l3m4n5o6p,John Doe, Engineer
b2c3d4e5-f6g7-8h9i-0j1k-2l3m4n5o6p7q,Jane Smith, Manager
c3d4e5f6-g7h8-9i0j-1k2l-3m4n5o6p7q8r,Bob Johnson, Analyst4. Combining Multiple Variables
Use Case: Create comprehensive log entries with multiple metadata
Input Text:
File uploaded successfully
User login detected
Payment processedConfiguration:
- Find: ^(.*)$(with regex enabled)
- Replace: [$date $time] Event #$counter: $1 (ID: $uuid)
Result:
[10/25/2024 2:30:15 PM] Event #1: File uploaded successfully (ID: d4e5f6g7-h8i9-0j1k-2l3m-4n5o6p7q8r9s)
[10/25/2024 2:30:15 PM] Event #2: User login detected (ID: e5f6g7h8-i9j0-1k2l-3m4n-5o6p7q8r9s0t)
[10/25/2024 2:30:15 PM] Event #3: Payment processed (ID: f6g7h8i9-j0k1-2l3m-4n5o-6p7q8r9s0t1u)Pattern Replacements in Batch Operations
You can also use pattern variables in batch operations. Each operation maintains its own counter sequence:
Example Batch Setup:
- Operation 1: Find TODO:→ ReplaceTask $counter: $date
- Operation 2: Find BUG:→ ReplaceIssue $counter: $time
Important Notes
- Counter Reset: The $counter starts from 1 for each replacement operation
- Single vs All: Use "Replace All" to process multiple matches with sequential counters
- Regex Required: Most pattern replacements work best with regex enabled for precise matching
- Real-time Processing: Variables are evaluated at replacement time, not when inserted
Text Transformations
Transform selected text with built-in functions:
- UPPERCASE: Convert to all uppercase
- lowercase: Convert to all lowercase
- Title Case: Capitalize the first letter of each word
Export Functionality
Export your results to Excel for further analysis:
- Summary sheet with operation details
- Original and modified text
- Batch operation configurations
- Timestamped files for tracking
Keyboard Shortcuts
| Shortcut | Action | 
|---|---|
| Ctrl+F | Focus search field | 
| Ctrl+R | Focus replace field | 
| Ctrl+Enter | Replace next occurrence | 
| Ctrl+Shift+Enter | Replace all occurrences | 
| Ctrl+Z | Undo last operation | 
| Ctrl+Y | Redo last undone operation | 
Practical Use Cases
Data Processing & Automation
- Convert plain text lists to numbered sequences using $counter
- Add timestamps to log files with $dateand$time
- Generate unique identifiers for data anonymization using $uuid
- Create SQL insert statements from CSV data with sequential IDs
- Standardize date formats across multiple documents
Content Management
- Convert TODO comments to numbered task lists
- Add creation metadata to documents
- Generate unique slugs for blog posts
- Create audit trails with timestamps
- Standardize naming conventions across projects
Code Refactoring
- Rename variables and functions
- Update import paths
- Replace deprecated syntax
- Standardize code formatting
Privacy Protection
- Mask sensitive information (SSN, emails, phone numbers)
- Remove personal identifiers
- Anonymize datasets
- Redact confidential content
Best Practices
Before Starting
- Always backup your original text
- Test with small samples first
- Use "Replace" instead of "Replace All" for sensitive operations
- Enable "Whole Word" for precise matching
Regular Expressions
- Test regex patterns before applying
- Use capturing groups (parentheses) effectively
- Escape special characters when needed
- Consider performance with large texts
Batch Operations
- Order operations from specific to general
- Test each operation individually first
- Use descriptive find/replace text
- Enable only the operations you need
Technical Implementation
Svelte 5 Features Used
- Runes: $state,$derived,$effect
- Snippets: Modern component composition
- TypeScript: Full type safety
- Reactive Updates: Real-time text processing
Performance Optimizations
- Debounced updates for large texts
- Efficient regex compilation
- Memory management for history
- Lazy rendering of highlighted matches
Troubleshooting
Regex not working as expected?
Ensure you're using the regex option and escaping special characters. Test your pattern in a regex tester first.
Replacements not being applied?
Check that your search term matches exactly (including case if case-sensitive is enabled). Try disabling "Whole Word" if matching partial words.
Performance issues with large texts?
Disable "Highlight Matches" for better performance with very large texts. Consider breaking large documents into smaller chunks.
Undo/Redo not working?
The Result field is read-only to maintain consistency. Undo/Redo tracks all changes made through the tool's replace functions and batch operations. This prevents confusion and ensures reliable operation history.
Advanced Examples
Pattern Replacement Examples
Creating Sequential Task Lists
Find: \\bTask\\b
Replace: Task $counter (with regex enabled)Converts "Task", "Task", "Task" to "Task 1", "Task 2", "Task 3"
Adding Timestamps to Log Entries
Find: ^(\\w+): (.*)$
Replace: [$date $time] $1: $2 (with regex enabled)Adds timestamps to structured log entries
Generating Unique Database Records
Find: ^([^,]+),([^,]+)$
Replace: INSERT INTO users VALUES ('$uuid', '$1', '$2'); (with regex enabled)Converts CSV data to SQL insert statements with unique IDs
Complex Regex Examples
Data Anonymization
Find: \\b\\d3-\\d2-\\d4\\b
Replace: SSN-$counter (with regex enabled)Replaces Social Security numbers with sequential identifiers
Email Standardization
Find: ([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
Replace: $1@company.com (with regex enabled)Standardizes email domains while preserving usernames
Batch Operation Patterns
Pattern replacements work in batch operations too:
- Operation 1: Find ERROR→ ReplaceIssue $counter: $1
- Operation 2: Find TODO→ ReplaceTask $counter: $1
Each operation maintains its own counter sequence.
This Find & Replace Tool combines powerful functionality with an intuitive interface, making it perfect for text manipulation tasks of any complexity. Whether you're cleaning data, refactoring code, or editing content, this tool provides the features and flexibility you need.
