The Replace Files command searches for a specified pattern in multiple files and replaces each occurrence with a new pattern.
Click this button to begin the replace operation.
Click this to select all the files in the file list.
Click this button to toggle the file list contents between showing file names, and showing only subdirectory names. When the subdirectories are shown, this button changes to “Show Files”.
Add the old pattern to be found and replaced in this text box. The pattern can be a regular expression.
Add the new pattern that should replace the old one in this text box.
The name of the file to search. You may also add a series of wildcard specifications and click the Replace button (or press Enter) and Source Insight will replace the file list with the results of the wildcard expansion. If the Project Wide option is on, the wildcards are expanded over the whole list of files in the current project; otherwise, the wildcards are expanded in the current directory.
If the Project Wide option is on, Source Insight will search the project symbol for file names added in the File Name text box, so you don’t have to include a directory specification for those files.
If the Project Wide option is on, then this list displays all files in the current project.
If the Project Wide option is off, then this list displays all the files in the current working directory. The current directory path is displayed above the file list. Source Insight shows only files for known document types in the current directory. The document types are specified with the Document Options command.
This check box controls whether the File list shows all the files in the project, or just the files in the current working directory.
If this check box is checked, then any selected directories are recursively searched. This option and the Project Wide option are mutually exclusive.
To recursively search a set of directories:
1. Uncheck the Project Wide check box.
2. Check the Include Subdirectories check box.
3. Select one or more directories in the file list.
You can also type a file wildcard specification in the File Name text box to limit the search to particular file extensions or names.
If checked, Source Insight will only find matches if the case matches exactly
Use Regular Expressions
If checked, the Old and New patterns are assumed to be regular expressions.
One Occurrence / Line
If checked, only the first occurrence of the Old pattern on each line is replaced. If not checked, then all occurrences of the Old pattern on each line are replaced.
Whole Words Only
If checked, then Source Insight only finds matches that are whole words. If not checked, then Source Insight will also find matches that are embedded in words.
Skip Inactive Code
If enabled, then only code that is active under conditional compilation is searched. You must first specify known conditions in the Preferences: Languages dialog box, in order for Source Insight to know what conditions are active or not. Conditional compilation only applies to some languages.
If enabled, then comments will not be searched.
Search Only Comments
If enabled, then only comments will be searched. This is mutually exclusive with the Skip Comments option. The comment options slow the search down a little.
Preserve Old Case
If checked, then Source Insight will replace text but retain the upper and lower case of the original text. If not checked, then Source Insight will replace text using the case exactly as it appears in the New text box. This option is most useful when Case Sensitive is off.
This feature lets you replace all occurrences of a word, regardless of case, and still maintain the original case. For example, let’s say you want to replace all “abc” and “ABC” with “xyz” and “XYZ” respectively. Add “abc” in the Old text box, add “xyz” in the New text box. Disable Case Sensitive, and enable Preserve Old Case.
Confirm Each Replacement
If checked, Source Insight will confirm each replacement by prompting you.
Confirm Each File
If checked, Source Insight will confirm each modified file by prompting you.
Include Read-Only Files (keep buffers open)
If checked, then replacements will be made inside of read-only file buffers. Source Insight will not attempt to save the file as the replacement operation progresses. The files will be left open and modified, allowing you to save the files yourself. If not checked, then read-only files will be skipped. Note that this options works independently from the Preferences: Files option Allow editing read-only file buffers.
You can make Source Insight automatically save over read-only files while replacing if you enable the Preferences: Files option: Save over read-only files without prompting.