Replace

The Replace command performs a search & replace operation on the current file. The search & replace 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 enabled, Source Insight will only find matches if the case matches exactly.

Use Regular Expressions

If enabled, the Old and New patterns are assumed to be regular expressions.

Wrap Around

If enabled, 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 enabled, the search stops when it reaches the end of the file.

One Occurrence / Line

If enabled, only the first occurrence of the Old pattern on each line is replaced. If not enabled, then all occur­rences of the Old pattern on each line are replaced.

Whole Words Only

If enabled, then Source Insight only finds matches that are whole words. If not enabled, then Source Insight will also find matches that are embedded in words.

Preserve Old Case

If enabled, then Source Insight will replace text but retain the upper and lower case of the original text. If not enabled, 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 enabled, 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.