Finding and Replacing Text

The Text editor supports full string searching. With full string searching, you specify the entire search string before the search begins. You can search for text in a single source file or in multiple files.

With the Find command, you can search the active window or all open documents for the following types of text strings:

To find or replace a text string

  1. Move the insertion point to where you want to begin your search. The editor uses the location of the insertion point to select a default search string.

  2. From the Edit menu, choose Find. The Find and Replace dialog box appears.

  3. In the Find what box, type the search text. You can also use the drop-down list to select from a list of the most recently used search strings.

  4. If you want to replace the string specified in the Find what box, type the replacement text in the Replace with text box. You can also use the drop-down list to select from a list of the most recently used replace strings

  5. Select any of the Find options.

  6. To start the search, click the Find/Replace button. The Find and Replace dialog box disappears and the Find/Replace dialog box appears when the search begins.

  7. - or -

    To replace all occurrences of the search string with the replace string click Replace All.

  8. To continue search, you can either click Find in the Find/Replace dialog box or close the Find/Replace dialog box and use the Find Next or Find Previous shortcut keys. The shortcut key for Find Next is F3; the key combination for Find Previous is SHIFT+F3.

  9. - or -

    To replace the current occurrence of the searched string click Replace.

To start a find without using the Find dialog box

To find a text string in multiple source files

  1. From the File menu, choose Find In Files.

  2. In the Find what box, type the search text. You can also use the drop-down list to select from a list of the most recently used search strings.

  3. In the In files/file types box, select the file types you want to search. You can use the drop-down list to select from common file types or to type text specifying other file types.

  4. In the In folder box, select the primary folder that you want to search. Click the Browse button to display the Choose Directory dialog box if you want to change drives and directories.

  5. If necessary, select one or more of the Find options.

  6. Click the Find/Replace button to begin the search. The Output window displays the list of file locations where the text string appears. Each occurrence lists the fully qualified filename, followed by the line number of the occurrence and the line containing the match.

  7. To open a file containing a match, double-click the entry in the Output window. An editor window containing the file opens, with the line containing the match selected. You can jump to other occurrences of the text string by double-clicking the specific entries in the Output window.

To replace a text string in multiple source files

  1. From the File menu, choose Find In Files.

  2. In the Find what box, type the search text. You can also use the drop-down list to select from a list of the most recently used search strings.

  3. In the Replace with text box, type the replace string. You can also use the drop-down list to select from a list of the most recently used replace strings.

  4. In the In files/file types box, select the file types you want to search. You can use the drop-down list to select from common file types or to type text specifying other file types.

  5. In the In folder box, select the primary folder that you want to search. Click the Browse button to display the Choose Directory dialog box if you want to change drives and directories.

  6. If necessary, select one or more of the Find options.

  7. Click the Find/Replace button to begin the search. The Find/Replace dialog box appears.

  8. - or -

    Click Replace All to replace all occurrences of the searched string.

  9. In the Find/Replace dialog box you can click either Find to go to the next occurrence of the searched text or Replace to replace the current occurrence.

When you jump to a found string location specified in the Output window, the corresponding source file is loaded if it is not already open in the editor.

Note: You can display the output from your last multiple-file search done during your current session by choosing the Output command from the View menu and by choosing the Find In Files tab in the Output window.

 

See also:

Output window