This documentation is archived and is not being maintained.

How to: Search Using Results Lists

You can perform bulk find and replace operations using the Find in Files and Replace in Files tabs of the Find and Replace window. These operations allow you to search files whether they are currently open in an editor, checked out to a local folder, or available on a network share.

Lists of matches found and changes made are displayed in the Find Results Windows. You can double-click any entry to jump to the line in your code where the match was found.

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

You can also 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. Those operations let you jump from match to match in the active document; the Find Results windows are not displayed. For more information on performing such rapid search and replace operations, see How to: Search Interactively.

To find a string or expression in multiple files or folders

  1. Switch any documents open in Design view editors to Source view.

  2. Select Find and Replace from the Edit menu and choose Find in Files.

    The Find in Files, Find and Replace Window opens.

  3. In the Look in drop-down list, enter one or more folder or file names to search, separated by semicolon (;) delimiters.

    —or—

    Click Choose Custom Folders to create and select your own list of folders and files to search, using the Choose Search Folders Dialog Box.

  4. Set Find options as needed.

    NoteNote:

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

    1. To enable the use of Wildcards or Regular Expressions, select Use and choose the desired option.

    2. In the File types list, select a set of file extensions from the list, or enter the extensions for the types of files to be searched, separated by semicolons (;). Use *.* to search all files in the folders listed in the Look in list.

  5. In Result options, the Find Results 1 window is selected by default. To view the search results in a new window, select the Find Results 2 window option.

  6. 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).

  7. Choose Find All to begin the search.

    The matches for the search appear in the selected Find Results window. To jump to a search match, double-click its entry.

To search matches in a Find Results window

  1. Conduct a Find in Files or Replace in Files operation.

  2. Select the active Find Results window.

  3. In the Find and Replace window, click the triangular View button on the Find tab and switch to Quick Find.

  4. In the Look in field of Quick Find, select Current Window.

  5. Enter a string or expression in the Find what field, and click Find Next.

    This lets you scan the Find Results window for matches found in particular folders or files, or matches on lines of code where some other key term also occurs. For further information, see Find Results Windows.

    TipTip:

    You can also search incrementally against large sets of matches in the Find Results window to locate a specific search match. For more information, see How to: Search a Document Incrementally.

You can use Quick Find to scan through a lengthy list of matches in a Find Results window.

To replace a string or expression across an entire solution

  1. Switch any documents open in Design view editors to Source view.

  2. Select Find and Replace from the Edit menu and choose Replace in Files.

    The Find and Replace window opens with the Replace in Files options displayed.

  3. In the Look in drop-down list, select Entire Solution.

  4. Set Find options as needed.

    1. To enable the use of Wildcards or Regular Expressions, select Use and choose the desired option.

    2. In the Look at these file types list, select file extensions from the list, or enter the extensions for the types of files to be searched, separated by semicolons (;). Use *.* to search all files in the folders listed in the Look in list.

  5. Set Result Options as needed.

    1. The Find Results 1 window is selected by default. To view the search results in a new window, select the Find Results 2 window option.

    2. To enable Undo, select the Keep modified files open after Replace All option.

    Caution noteCaution:

    You can only use Undo on files that remain open for editing after the replace operation. If this option is not selected, files that were not already open for editing remain closed. No Undo option will be available in those files.

  6. 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).

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

    —or—

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

  8. Choose Replace and continue choosing Replace until the last match in the last file has been replaced. Use Find Next to skip a single match you do not want to replace. Use Skip File to ignore all matches in a particular file move on to the next file in the solution.

    —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.

Show: