Find and Replace in Files
Multi Commander's Find and Replace tool is a sophisticated text processing utility designed for batch text manipulation across multiple files. With advanced pattern matching capabilities, multiple operation modes, and robust encoding support, it provides enterprise-grade text processing for developers, system administrators, and content managers.

The Find and Replace dialog provides comprehensive text processing options for batch operations
Overview and Capabilities
The Find and Replace tool operates on all selected text files in the Explorer Panel, making it ideal for large-scale text processing operations. The tool automatically detects and preserves file encoding (ASCII, Unicode, UTF-8) while maintaining original line ending formats throughout the process.
File Processing
Find and Replace processes all selected text files. The dialog displays the number of files selected for processing. Binary files are automatically detected and excluded to prevent corruption, though users should exercise caution with file selection.
Advanced Features
- Multiple file batch processing
- Automatic encoding detection and preservation
- Four distinct operation modes
- Wildcard pattern matching
- Case-sensitive and case-insensitive operations
- Multiline text support
- Line ending preservation
- Flexible output file management
Enterprise Options
- Silent mode for automated operations
- UTF-8 encoding enforcement
- Backup file creation
- Original file replacement options
- Command-line automation support
- Error logging and reporting
- Progress tracking for large operations
- Future regular expression support
File Output Management
Filename Configuration
The filename field controls how processed files are named and saved, with support for both single and batch operations:
Single File Processing
Specify a custom filename for the output. The original file extension is automatically preserved unless explicitly changed.
Example: "document.txt" → "document_updated.txt"
Batch File Processing
Use "*" as a placeholder for the original filename. The wildcard represents both filename and extension.
Example: Pattern "*_replaced.*" transforms "file1.txt" → "file1_replaced.txt"
Save Options
The "Save as..." dropdown provides comprehensive output management strategies:
Option | Behavior | Use Case |
---|---|---|
New Name | Create new file with specified name pattern | Preserve originals while creating processed versions |
Keep Original (.bak) | Replace original file, rename old file to .bak extension | Update files while maintaining automatic backup |
Delete Original | Replace original file completely | Direct replacement without backup (use with caution) |
Text Input Fields
Text to Find
The search field accepts the text patterns to be located and replaced. The behavior varies significantly based on the selected operation mode:
- Single Line Mode: Enter one search pattern
- Multiple Line Mode: Enter multiple search patterns (one per line)
- Multiline Text Mode: Enter text spanning multiple lines with embedded newlines
- Wildcard Support: Use * and ? for pattern matching when enabled
Text to Replace With
The replacement field defines what text will replace the found patterns. The interpretation depends on the selected operation mode:
- Single Replacement: One replacement text for all matches
- Paired Replacement: Each search pattern paired with corresponding replacement
- Common Replacement: Multiple search patterns replaced with single text
- Multiline Replacement: Text spanning multiple lines with preserved formatting
Find and Replace Operation Modes
Multi Commander provides four sophisticated operation modes to handle different text processing scenarios:
1. Find One, Replace with One
Function: Simple one-to-one replacement using only the first line of each field
Behavior: Replaces all instances of the search text with the replacement text
Best For:
- Simple text substitutions
- Variable name changes in code
- URL updates in documentation
- Company name changes
Example: Replace "oldfunction()" with "newfunction()" throughout codebase
2. Find Many, Replace with Many
Function: Line-by-line paired replacement using corresponding lines from each field
Behavior: Line 1 in find field → Line 1 in replace field, Line 2 → Line 2, etc.
Best For:
- Multiple simultaneous substitutions
- Configuration file updates
- Translation file modifications
- Batch variable renaming
Example Configuration:**
Find:
server1.old.com server2.old.com server3.old.com
Replace with:
server1.new.com server2.new.com server3.new.com
3. Find Many, Replace with Same
Function: Multiple search patterns replaced with single replacement text
Behavior: All patterns in find field replaced with first line of replace field
Best For:
- Consolidating variations
- Standardizing terminology
- Removing deprecated alternatives
- Data cleanup operations
Example Configuration:**
Find:
colour Color COLOR
Replace with:
color
4. Find and Replace Multiline Text
Function: Advanced multiline text processing with preserved formatting
Behavior: Handles text blocks spanning multiple lines with embedded newlines
Key Features:
- Preserves original file's line ending format
- Handles complex text structures
- Maintains spacing and indentation
- Supports code block replacement
Best For:
- Code refactoring
- Template modifications
- Documentation updates
- Configuration block replacement
Example - Replace function definition:**
Find:
function oldFunction() { return "old"; }
Replace with:
function newFunction() { return "new"; }
Advanced Options and Settings
Pattern Matching Options
Wildcard Matching
Status: Currently Available
Supported Wildcards:
- * (asterisk): Matches any sequence of characters
- ? (question mark): Matches any single character
Examples:
file*.txt
matches "file1.txt", "fileABC.txt"test?.log
matches "test1.log", "testA.log"
Caution: Using * at the beginning and end of expressions can produce unexpected results. Test thoroughly before processing originals.
Regular Expression Matching
Status: Coming Soon
Regular expression support is planned for future versions, which will provide:
- Complex pattern matching
- Capture groups and backreferences
- Advanced text transformation
- Professional-grade text processing
Use wildcard matching for current pattern needs.
Text Processing Options
Ignore Case
Performs case-insensitive matching, treating "A" and "a" as equivalent.
Benefits:
- Handles inconsistent capitalization
- Useful for user-generated content
- Simplifies text standardization
Example: "Hello", "HELLO", and "hello" all match "hello"
Force UTF-8 for ASCII
Enforces UTF-8 encoding for files detected as ASCII, ensuring proper character handling.
Use Cases:
- Files with special characters
- International text content
- When encoding detection is uncertain
Note: Resolves ambiguity between ASCII and UTF-8 detection
Automation and Silent Operation
Silent Mode - Show No Dialogs
Enables fully automated operation without user interaction prompts.
Behavior in Silent Mode:
- No confirmation dialogs shown for matches
- "Replace All" is automatically assumed
- No error dialogs displayed to user
- Errors logged to application log for later review
Ideal For:
- Automated build processes
- Batch processing scripts
- Scheduled maintenance tasks
- Command-line automation
Advanced Configuration Examples
Multi-Pattern URL Update
Scenario: Update multiple old domain references to new domain
Mode: Find Many, Replace with Same
Find:
http://old-site.com
https://old-site.com
www.old-site.com
Replace with:
https://new-site.com
Configuration Block Replacement
Scenario: Replace entire configuration sections
Mode: Find and Replace Multiline Text
Find:
<database>
<host>old-server</host>
<port>3306</port>
</database>
Replace with:
<database>
<host>new-server</host>
<port>5432</port>
<ssl>true</ssl>
</database>
Variable Renaming with Wildcards
Scenario: Update variable naming convention
Mode: Find One, Replace with One (with wildcards)
Find (with wildcards enabled):
old_variable_*
Replace with:
newVariable*
Command-Line Integration and Automation
Automation Parameters
Find and Replace functionality is available through Multi Commander's custom command system for automation:
Parameter | Description | Example Value |
---|---|---|
FILE |
Specific file to process | "C:\config\app.ini" |
FIND |
Text to find | "old-server" |
REPLACEWITH |
Replacement text | "new-server" |
MODE |
Operation mode | "One", "Many", "ManySame", "Multiline" |
IGNORECASE |
Case sensitivity | 1 (ignore) or 0 (sensitive) |
WILDCARD |
Enable wildcard matching | 1 (enabled) or 0 (disabled) |
SILENT |
Silent operation | 1 (silent) or 0 (interactive) |
Example Automation Script
# Update configuration files in deployment
MC.Utils.FindAndReplace FILE="config.ini" FIND="server=old" REPLACEWITH="server=new" MODE="One" SILENT=1
# Multi-pattern replacement
MC.Utils.FindAndReplace FILE="*.txt" MODE="Many" FIND="pattern1\npattern2" REPLACEWITH="new1\nnew2" SILENT=1
File Encoding and Preservation
Encoding Detection and Handling
Find and Replace includes sophisticated encoding management:
Supported Encodings
- ASCII: Standard 7-bit character encoding
- UTF-8: Unicode Transformation Format 8-bit
- Unicode: UTF-16 with BOM detection
Preservation Features
- Line Endings: Maintains original line ending format
- BOM Handling: Preserves Byte Order Marks
- Character Integrity: No data loss during processing
Line Ending Preservation
The system intelligently handles different line ending formats:
- Windows (CRLF): Preserves \r\n sequences
- Unix/Linux (LF): Maintains \n characters
- Classic Mac (CR): Preserves \r characters
- Mixed Formats: Handles files with inconsistent line endings
Error Handling and Safety
Binary File Protection
Automatic Binary Detection
Find and Replace automatically identifies and skips binary files to prevent corruption. However, detection is not 100% accurate, so users should carefully select only text files for processing.
Error Logging and Recovery
- Application Logs: All errors logged to Multi Commander's application log
- Operation Tracking: Progress and results tracked for large operations
- Backup Options: Built-in backup creation for safe processing
- Rollback Support: .bak files enable manual rollback if needed
Troubleshooting Common Issues
- Verify the correct operation mode is selected for your use case
- Check case sensitivity settings if matches aren't found
- Test wildcard patterns carefully before processing all files
- Ensure line-by-line pairing is correct in Many-to-Many mode
- Verify multiline text includes proper line breaks
- Check if binary files were accidentally processed
- Verify character encoding is appropriate for file content
- Enable UTF-8 forcing for international character files
- Restore from .bak files if available
- Test encoding settings with a single file first
- Be cautious with * at the beginning and end of patterns
- Test patterns with small sample files first
- Remember that * matches zero or more characters
- Use ? for single character matching when appropriate
- Consider using exact matching if wildcards are problematic
- Process files in smaller batches for better control
- Close other applications to free system resources
- Use Silent mode to reduce UI overhead for large operations
- Consider processing during off-peak hours
- Monitor system resources and adjust batch sizes accordingly
Related Tools and Integration
Find and Replace works seamlessly with other Multi Commander text processing tools:
- Sort Lines: Organize text before or after replacement operations
- Text Conversion Tools: Standardize line endings and encoding before processing
- File Search: Locate files containing specific patterns for processing
- MultiScript: Create complex automated workflows combining multiple text operations
Pro Tip
Always test your find and replace operations on a small set of backup files first. Use the "New Name" save option to create processed versions alongside originals, allowing you to compare results before committing to replace the original files.
Related Documentation
For more information about Multi Commander's text processing capabilities, see Text Conversion Tools,
Sort Lines in Files, and Text Tools Overview.