Exercise 3.8: Finding and replacing text

Before you begin, you must complete Exercise 3.5: Invoking language-sensitive help.

The LPEX Editor also has a powerful find and replace text feature. You use the Find and Replace window to search for an item. You can search for a word, a partial word, or a sequence of such. You can also enter a pattern you want to match, provided that the pattern follows the rules of regular expression. You can replace the found search item. If the entered text or pattern is found, the cursor moves to either the next or previous occurrence of the search item, according to your chosen search direction, and replaces the found text according to your selections.

To find and replace text:

  1. Press Ctrl+Home to go to the top of the file.

    Tip: When you press Ctrl+Home to go to the top of a file or Ctrl+End to go to the bottom of a file, a quick mark is set at your cursor position. This allows you to return to that line by pressing Alt+Q. Ctrl+Q will set a quick mark.

  2. Click Edit > Find/Replace from the workbench menu or press Ctrl+F.

    The Find/Replace window opens at the bottom of the Editor window.
    Find/Replace window

    At the bottom of this window, you will notice that you have some options to select from, for example, search only in certain columns, etc. You want to find the first occurrence of MSTDSP.

  3. In the Find field, enter MSTDSP to find the start of a file section.
  4. Make sure the Replace field is blank.

    You would use this field for text replacement.

  5. Click Next to go to the next location of MSTDSP in the file.

    The Editor moves the active line to line 37, which contains the first MSTDSP phrase in the file.

  6. Click in the Editor window to close the Find/Replace window.

You have searched for an item in your source using the Find/Replace window and now you are ready to begin Exercise 3.9: Filtering lines by string.