Applied Parameters: None
This command is used to access the Replace Text dialog, from where you can configure a search to locate and replace specific text - located in the current document, all text-based documents in the active project, all open text-based documents, or all text-based documents in a specified directory.
This command can be accessed from the Text Editor (or any coding-aware variant of the Text Editor), by:
- Choosing the Edit » Replace command from the main menus.
- Using the Ctrl+H keyboard shorcut.
After launching the command, the Replace Text dialog will appear. The dialog essentially operates in two modes, with functionality delivered courtesy of two tabs:
- Replace Text - use the options on this tab to configure text replacement within the current document only. To replace only the first instance of matching text, click OK. If the Prompt on replace option was enabled, the text will be highlighted, with a dialog appearing to confirm the replacement. Click Yes to replace only this instance. You will have the opportunity to replace all matching instances from this dialog. Alternatively, to replace all from the start, click Replace All, rather than OK. Again, all matching instances of the search text will either be replaced directly, or through individual prompting, depending on the state of the Prompt on replace option.
- Replace in Files - use the options on this tab to configure a text replacement across all text-based documents in the active project, all open text-based documents, or all text-based documents in a specified directory. After clicking OK, all instances of matching text found in the files coming under the scope of the search, will be replaced. Again, you can opt to be prompted on replacement by setting the Prompt on replace option beforehand. The Replacing dialog will appear to show progress of the replacement. Each replacement made will be listed as entries in the Messages panel. Each message will reflect the source file, the line on which the searched text was found, the entire text on that line, and the character position within that line at which the searched text string starts.
In each case, an information dialog will appear, summarizing the number of replacements made.
- Each message in the Messages panel is in the form (x, y): <OriginalLineText>, where x is the character position on line y of the document. The text shows the original text, prior to replacement.
- Files do not have to be open in order to replace text using the Replace in Files mode. Such files can optionally be opened after replacement by enabling the Open changed files in editor option, prior to performing the replacement.
- When using the Replace in Files mode, resulting replaced text can be cross-probed to, from the Messages panel entry - simply double-click on the message.
- See related options in the Find region, on the Text Editors - General page of the Preferences dialog.