Dela via


How to: Search a Document Incrementally

You can search an individual document or window incrementally by entering a search string character by character, then observing the matches found as the search string lengthens. To activate an incremental search, choose Advanced from the Edit menu and choose Incremental Search.

An incremental search automatically searches the entire document or all text within a window, with the exception of text that has been collapsed or concealed. The editor highlights the first set of characters found in the document or window that match the search string entered.

Note

You cannot use wildcards or regular expressions in search strings for incremental searches.

Incremental searches are performed by default from the current location in the document downward, and from left to right. To move to the next match, press CTRL+I. To reverse the direction of the search, press CTRL+SHIFT+I.

The options set in the Find and Replace window are global. This means they persist from one search of any kind to the next. Incremental searches use the Match case option setting from your previous search. If, for example, you previously selected the Match case option for a search performed from the Find in Files, Find and Replace Window, and then you perform an incremental search, the incremental search will also be case sensitive.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To search incrementally

  1. Place the cursor in a blank section of the file or window you want to search.

  2. From the Edit menu, choose Advanced, and then select Incremental Search.

    The cursor icon changes to binoculars with an arrow indicating the search direction, and the status bar displays the text Incremental Search.

  3. Begin typing the search string.

    The status bar displays the search string you are entering, and the editor highlights the first match found for what you have typed so far.

  4. Continue to add characters to the search string.

    The editor searches again for a match of the augmented search string, and again highlights the first match found.

    If no match is found, the status bar displays the following message:

    Incremental Search: <text> (not found)

You can use the following shortcut keys while performing an incremental search:

To

Use

Move to the next match in the file

CTRL+I

Reverse the direction of the search

CTRL+SHIFT+I

Remove a character from the search string

BACKSPACE

Stop the incremental search

ESC

See Also

Tasks

How to: Search Interactively

How to: Search Using Results Lists

Reference

Quick Find, Find and Replace Window

Find in Files, Find and Replace Window

Find/Command Box

Other Resources

Finding and Replacing