The Replace in Files command is used to search a list of files for a specified pattern and replace it with another pattern. You specify the list of folders and file mask that determine the list of files and you enter both patterns to search in a Find in Files Window. The “Find and replace mode” switch must be enabled for this command.
Replace in Files function operates in one of two modes: Replace all occurrences and save and Replace all occurrences and open.
In this mode, all candidate files are searched for a search pattern. All occurrences are replaced with a replace pattern. If the replace pattern is empty, all matches are removed from the file. Any matched file is added to the results list. All modifications made to a file are immediately saved. The Always create backups Option is used to determine whether to make backup copies of modified files.
Double-clicking the file in a result list opens the file.
In this mode, all candidate files are searched for a search pattern. All found occurrences are replaced with a replace pattern. Files then are opened in the editor. Operation history for an opened file contains a Replace All command. You can then continue editing the document, save changes, or close the document without saving changes.
The Replace in Files command fully supports regular expressions. To search using regular expressions, select either “ASCII string (char)” or “UNICODE string (wchar_t)” pattern type, enter the regular expression, make sure the Regular expression checkbox is checked and enter the sub-expression number you want to search for. Sub-expression
0 represents the expression itself. Replace pattern cannot be a regular expression.