Share via


Find in Files

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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 menu bar, choose Edit, Find and Replace.

  2. Choose Find in Files.

    To cancel a Find operation, press CTRL + BREAK.

Note

The Find and Replace tool does not search directories with the Hidden or System attribute set.

Find what

To search for a new text string or expression, specify it in the box. To search for any of the 20 strings that you searched for most recently, open the list, and choose the string for which you want to search. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your search string. For more information, see Using Regular Expressions in Visual Studio.

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.

Warning

With the Entire Solution or Current Project options, project and solution files are not searched. If you want to look in project files, choose a search folder.

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.

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 Regular Expressions If this check box is selected, you can use special notations to define patterns of text to match in the Find what or Replace with text boxes. For a list of these notations, see Using Regular Expressions in 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.

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.

Append results Appends the results from the search to the previous search results.

See Also

Finding and Replacing Text Replace in Files Visual Studio Commands