Visual Studio Incremental Search
Visual Studio provides several tools to allow you to quickly locate text within a file, project or solution. This article describes the Incremental Search feature, which permits fast searching of a file with no interaction with dialog boxes required.
Visual Studio's Incremental Search feature provides an incredibly fast way to find text in an editor window. Unlike the standard Find and Replace, Incremental Search does not display any dialog boxes. Instead, each key press adds to a search term and performs an immediate search operation. As the length of the typed term increases, the accuracy of the search improves.
To start an incremental search, press Ctrl-I. You should see the words "Incremental Search" appear in Visual Studio's status bar. You can now begin to type your search term. With each key press, the selection within the text editor window will change to show the first occurrence of the entered word or phrase. The status bar will also update to show the current search text. If the search term is not found, a sound is emitted. If you mistype, use the Backspace key to remove characters from the string.
If the search does not locate the desired instance of the text, you can navigate between matches by pressing Ctrl-I for the next occurrence and Ctrl-Shift-I for the previous one. Once the correct item is found, press the Escape key to end the process.
In the diagram above you can see that the search was case-insensitive. Visual Studio determines whether the search is case-sensitive or not using the Match Case option from the Find and Replace dialog boxes. The incremental search applies the option used for the last Find operation.
Incremental Search has some limitations due to its simplicity. The key limitations are listed below. Where these are problematic, you should use the standard Find and Replace features.
- Incremental Search finds text within the current editor window only. It does not search over multiple files.
- Hidden areas, such as collapsed code regions, are not included within the search.
- You may not use wildcards or regular expression in the search term.
17 October 2009