14.2.2. Searching and replacing text

To find and replace text in the current source file displayed in the File Editor pane:

  1. Position the cursor in the current file.

  2. Select Find → Replace... to display the Find and Replace dialog box. This has the same controls as the Find dialog shown in Figure 14.1.

  3. Enter the required text string into the Find field.

  4. Click the Find button.

  5. If there is no occurrence of the search string in the current file then an information box is shown saying that there is no match, the default, or the Code window flashes.

  6. When a match is highlighted either:

    • click the Find button again to search for the next occurrence of the text string

    • replace the current selection.

  7. Click Close to close the Find and Replace dialog box.

Making global changes

The Find and Replace dialog box also enables you to specify a global change where every occurrence of the search string is replaced in a single operation. Use the Replace All button to make a global change.

The search stops when all the matches have been replaced. There is no report detailing the number of replacements made but searching for the same string again shows that it no longer exists in the current file.

If you want to make the same global change in a second file tab then switch to the new tab without closing the Find and Replace dialog box and click Replace All again. In this way all occurrences of the text string are replaced in the second file.

Case sensitivity

By default, searches are case sensitive, that is, uppercase and lowercase are treated as distinct. Select the Insensitive Searches check box on the Find or the Find and Replace dialog box to change this for the current debugging session. When replacing a text string, the replacement string is always used exactly as entered in the Replace field. You must also enter spaces if required, in both the Find and Replace fields, because these are matched exactly.

Undoing replacements

You can reverse any search and replace operation. To do this, select the Edit → Undo option to reverse the last action. Where you have used the Replace All button, you must undo each replacement in turn as there is no Undo option for a global replacement.

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B