Export (0) Print
Expand All

How to: Search Interactively 

You can search one or more open documents or windows using the Find/Command Box or the Quick Find and Quick Replace portions of the Find and Replace Window. These operations let you jump from match to match in the active document; the Find Results windows are not displayed.

To review the keyboard shortcuts for search and replace operations, see Shortcut Keys.

You can also do bulk find and replace operations using the Find in Files and Replace in Files portions of the Find and Replace window. Those operations display lists of matches found and changes made in the Find Results Windows. For more information on performing such bulk search and replace operations, see How to: Search Using Results Lists.

NoteNote

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 the current document from the Find/Command box

  1. Open the files that you wish to search in a code editor.

  2. On the Standard toolbar, select the Find/Command box.

  3. Type the text you want to search for and press ENTER.

    The first match for the search text is selected.

  4. Press F3 to navigate to the next match.

    When the entire document has been searched, a message box appears.

To find a string or expression in all open documents

  1. Select Find and Replace from the Edit menu and choose Quick Find.

    The Find and Replace window opens with the Quick Find options displayed.

  2. In the Look in drop-down list, select All open documents.

  3. Set Find options as needed.

    NoteNote

    To enable the use of Wildcards or Regular Expressions, select Use and choose one of those options. Find options are global, so they remain in effect from search to search. For more information on the available Find options, see Quick Find, Find and Replace Window.

  4. In the Find what text box, enter the string or expression that you want to find. To add special characters, click the triangular Expression Builder button next to this text box and choose Wildcards or Regular Expressions.

    NoteNote

    For lists of available special characters, see Wildcards (Visual Studio) and Regular Expressions (Visual Studio).

  5. Click Find Next to start the search, and continue clicking Find Next until the last open file has been searched.

    When you have returned to the starting point of the search, a message appears.

To replace a string or expression in all files of the current project

  1. Choose Find and Replace from the Edit menu and select Quick Replace, or press the default shortcut keys CTRL+H.

    The Find and Replace window opens with the Quick Replace options displayed.

  2. In the Look in drop-down list, select Current Project.

  3. Set Find options as needed.

    To enable the use of Wildcards or Regular Expressions, select Use and choose one of those options.

    NoteNote

    Find options are global, so they remain in effect from search to search. For more information on the available Find options, see Quick Replace, Find and Replace Window.

  4. In the Find what text box, enter the string or expression that you want to find. To add special characters, click the triangular Expression Builder button next to this text box.

    NoteNote

    For lists of special characters, see Wildcards (Visual Studio) and Regular Expressions (Visual Studio).

  5. To replace instances of the Find with string with another string, enter the replacement string in the Replace with text box.

    —or—

    To delete instances of the Find with string, leave the Replace with text box blank.

  6. Choose Replace and continue choosing Replace until the last match in the last file has been replaced. Use Find Next to skip a match you do not want to replace.

    —or—

    Choose Replace All to replace all matches at once. A message box appears, listing the total number of replacements.

    NoteNote

    The Replace All command replaces every match in every file. To reverse the Replace All operation in any open file, choose Undo from the Edit menu before saving that file.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft