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
On the Edit menu, click Find and Replace.
Choose Find in Files.
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.
The Find and Replace tool does not search directories with the Hidden or System attribute set.
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.
[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.
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.
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.
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.
Project and solution files are not searched. If you want to look in project files, choose a search folder. See Browse.
- 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.
Specifies that subfolders of the Look in folder will be searched.
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.
Indicates how to interpret special characters entered in the Find what or Replace with text boxes. The options include:
- 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 (;).
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.
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.
Find (left drop-down)
Find in Files
Replace (right drop-down)
Replace in Files