Replace

The Replace command searches for a specified pattern and replaces each occurrence with a new pattern. Only the current file is searched. The search can be done over the whole file, or just the current selection.

Old

Add the old pattern you want to replace in this text box. The pattern can be a regular expression.

New

Add the new pattern that should replace the old one in this text box.

Replace

Click this to begin the replacing operation.

Files

Click this button to transfer to the Replace Files command, where you can perform replacements in multiple files.

Options Group

Case Sensitive

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.

Wrap Around

If checked, the search continues at the beginning of the file when it reaches the end of the file. The search will wrap around only once. If not checked, the search stops when it reaches the end of the file.

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.

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 Replacements

If checked, Source Insight will confirm each replacement by prompting you.

Search Group

The Search group of options specifies the scope of the search.

Selection

Searches only the currently selected text. This check box is automatically checked if the current selection is extended when the Replace command is invoked.

Whole File

Searches the whole file, from the first line to the last. This check box is automatically checked if the current selection is an insertion point when the Replace command is invoked.

Nothing checked in this group means to start searching at the current selection, and continue to the end of the file.