Share via


Find in Files, Find and Replace Window

Find in Files allows you to search a specified set of files. The matches found and actions taken are listed in the Find Results window selected in Result options.

You can use any of the following methods to display Find in Files in the Find and Replace window.

To display Find in Files

  1. On the Edit menu, click Find and Replace.

  2. Choose Find in Files.

    —or—

    If the Find and Replace window is already open, on the toolbar, click the triangular View button on the left drop-down and then choose Find in Files.

To cancel a Find operation, press CTRL + BREAK.

Note

The Find and Replace tool will not search for files in directories with the Hidden or System attribute set.

Find what

These controls allow you to specify the string or expression that will be matched.

  • Find what
    Reuse one of the last 20 search strings by selecting it from this drop-down list, or type a new text string or expression to find.

    Option

    Description

    [string with wildcards]

    To use wildcards such as asterisks and question marks in your search string, first select the Use check box under Find options and choose Wildcards.

    [regular expression]

    To cause the search engine to interpret your search string as a regular expression, select the Use check box under Find options and choose Regular expression.

  • Expression Builder
    This triangular button next to the Find what field becomes available when the Use check box is selected in Find options. Click this button to display a list of wildcards or regular expressions, depending upon the Use option selected. Choosing any item from this list adds it into the Find what string.

  • Find All
    Click this button to find all instances of the Find what string within the search scope chosen in Look in. The results are displayed in the Results window chosen under Result options.

Look in

The option chosen from the Look in drop-down list determines whether Find in Files searches only in currently active files or in all files stored within certain folders. Select a search scope from the list or click the Browse (...) button to display the Choose Search Folders Dialog Box and to enter your own set of directories. You can also type a path directly into the Look in box.

Note

If the Look in option selected causes you to search a file that you have checked out from source code control, only the version of that file which has been downloaded to your local machine is searched.

  • Look in
    Select a predefined search scope from this list, or use the Choose Search Folders dialog box to enter your own set of directories.

    • Current Document
      This option is available when a document is open in an editor. Searches only the active document for the Find what string.

    • All Open Documents
      Searches all files currently opened for editing.

    • Entire Solution
      Searches all files in the active solution.

    • Current Project
      Searches all files in the active project.

    • Visual C++ Include Directories
      This option becomes available while editing Visual C++ projects. Searches all files in the Include Directories.

  • Browse (...)
    Choose this button to display the Choose Search Folders Dialog Box, where you can assemble, edit, save, and select named sets of directories to enter in the Look in field.

Include subfolders

Specifies that subfolders of the Look in folder will be searched.

Find options

You can expand or collapse the Find options section. The following options can be selected or cleared:

  • Match case
    When selected, a Find Results search will be case-sensitive

  • Match whole word
    When selected, the Find Results windows will only return whole word matches.

  • Use
    Indicates how to interpret special characters entered in the Find what or Replace with text boxes. The options include:

    Option

    Description

    Wildcards

    Special characters such as the asterisk and question mark. For a list of wildcards, see Wildcards (Visual Studio).

    Regular Expressions

    Notations defining patterns of text to match. For a list, see Regular Expressions (Visual Studio).

  • Look at these file types
    This list indicates the types of files to search through in the Look in directories. If this field is blank, all of the files in the Look in directories will be searched.

    Select any item in the list to enter a preconfigured search string that will find files of those particular types.

    To find a type of file not available from the drop-down list, enter an asterisk (*) wildcard for the file name, followed by a period (.) and the desired file extension. To find more than one file type, enter multiple file extensions separated by a semicolon (;).

Result options

You can expand or collapse the Result options section. The following options can be selected or cleared:

  • Find Results 1 window
    When selected, the results of the current search will replace the content of the Find Results 1 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and choose Find Results 1.

  • Find Results 2 window
    When selected, the results of the current search will replace the content of the Find Results 2 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and choose Find Results 2.

  • Display file names only
    Displays a list of files containing search matches rather than displaying the search matches themselves.

Toolbar

A toolbar, with two drop-downs, appears at the top of the Find and Replace window. These drop-downs allow you to choose the type of search or replace you intend to perform and changes the options displayed in the window to match.

Drop-down

View menu

Find (left drop-down)

Quick Find

Find in Files

Find Symbol

Replace (right drop-down)

Quick Replace

Replace in Files

See Also

Tasks

How to: Search Interactively

How to: Search Using Results Lists

How to: Search a Document Incrementally

Reference

Replace in Files, Find and Replace Window

Quick Find, Find and Replace Window

Visual Studio Commands with Arguments

Other Resources

Find and Replace Window

Finding and Replacing

Change History

Date

History

Reason

July 2008

Added note about not searching hidden and system files.

Customer feedback.