Finding Text

You can search for any string of characters contained in the source code of an active editor window by using one of the following methods:

  • Mark a search string in the source to highlight all matches.

  • Type text in the source to immediately find the next match by using the Incremental Find function.

  • Specify additional search criteria to find matches in single or multiple program editor windows by using the Find function.

By default, Incremental Find and Find restart a search from the beginning when the end of the source code is reached. If you want to terminate the find operation when the end of the source is reached, set the Stop find at end editor option described in Program Editor Options in the Using Natural Studio documentation.

Start of instruction setTo find a string by marking text

  1. Select a whole word by positioning the cursor anywhere in the word you want to find. See also To select a whole word in the section Creating and Modifying Source Code.

    Or:
    Select any series of characters. See also To select any portion of text in the section Creating and Modifying Source Code.

    Note that the character string may not span one or more lines.

  2. Press the CTRL+SPACEBAR toggle.

    All instances of the search string found are highlighted.

  3. If you want to switch highlighting off, press ESC or position the cursor anywhere within a highlighted word or in the white space areas of the source code and press CTRL+SPACEBAR.

Start of instruction setTo find a string by using Incremental Find

  1. From the Edit or context menu, choose Incremental Find.

    Or:
    Press CTRL+J.

    The Incremental Find mode is set as indicated by the corresponding message in the status bar: Incremental find started.

  2. Type any text.

    As you type text, the first match for this text is highlighted. The search string is updated for each character typed. The current search string is indicated in the status bar.

  3. You can press DOWN-ARROW or UP-ARROW to go to the next or previous match respectively.

  4. You can terminate the find operation by pressing ESC or ENTER.

    The Incremental Find mode is deactivated as indicated by the corresponding message in the status bar: Incremental find canceled.

Start of instruction setTo find a string by using Find

  1. From the Edit or context menu, choose Find.

    Or:
    Choose the following toolbar button:

    graphics/pgm_win_find_next.png

    Or:
    Press CTRL+F.

    The Find dialog box appears.

  2. In the Find dialog box, you can specify the following:

    • In the Find combo box, enter the character string to be found or select a character string from the drop-down list box. All character strings used in previous searches are retained in the list box for the duration of the current Natural session.

    • Select the Case sensitive check box (not selected by default) if you want to search for strings that exactly match the entry in the Find text box. Otherwise, any combination of upper and lower-case letters will be found.

    • Select the Whole words only check box (not selected by default) if you want to restrict the search to whole words only. Otherwise, all occurrences of the string will be found.

    • Select the Exclude collapsed blocks check box to exclude collapsed blocks from the search; do not select the box (this is the default setting) if you want to scan the entire (expanded) source code. Exclude collapsed blocks is only available if structured mode was used for the source(s) to be scanned and if the Expand/Collapse editor option is selected (see Program Editor Options in the Using Natural Studio documentation).

      For more information on expanded and collapsed code blocks, see Showing and Hiding Source Code.

    • Select the Search up check box to perform the search from the current position of the text insertion caret to the beginning of the source (up). If this check box is not selected (this is the default setting), the search is performed from the current caret position to the end of the source (down).

    • Select the Highlight occurrences check box if you want to immediately view all instances of the search string found. Otherwise, the first instance found is selected. To switch highlighting off, see Step 3 of To find a string by marking text.

      For a different highlight color, use the Colors editor option and change the color definition of Highlighted text as described in Program Editor Options in the Using Natural Studio documentation.

    • Select the Current editor window radio button (selected by default), if you want to scan only the source code contained in the current window of the program editor.

    • Select the All program editor windows radio button, if you want to scan the source code contained in all open windows of the program editor.

    • You can choose the Help button to invoke the online documentation for help information on finding text.

  3. Choose the Find Next button to execute the find function.

    Depending on the setting of the Search up check box, the find goes down or up the source code from the current caret position:

    • If no instance of the search string is found, a corresponding message is displayed.

    • If an instance of the search string is found, it is selected.

    • If you selected Highlight occurrences, the first instance found is selected and all other instances are highlighted.

  4. If the first instance of a search string is selected, you can go to the next instance by choosing one of the following methods:

    In the Find dialog box, choose the Find Next button.

    Or:
    From the Edit or context menu, choose Find Next.

    Or:
    Choose the following toolbar button:

    graphics/pgm_win_find_next.png

    Or:
    Press F3.

  5. You can choose the Close button to close the Find dialog box. However, you can also edit the current source when the Find dialog box is open.

    When the Find dialog box is closed, you can continue the search function by using the alternative methods described earlier in Step 4.