Quick Replace, Find and Replace Window
Quick Replace allows you to search the code of one or more open files for a string or expression, and change all or part of any matches found. The selection moves from match to match, allowing you to consider each replacement in its surrounding context.
The matches found are not listed in the Find Results windows.
You can use any of the following methods to display Quick Replace in the Find and Replace window.
To display Quick Replace
On the Edit menu, expand Find and Replace.
Choose Quick Replace.
If the Find and Replace window is already open, on the toolbar, click the triangular View button on the right drop-down list and then choose Quick Replace.
Quick Replace can search through a document either forward or backward from the insertion point. The search automatically continues past the end or start of the document into the unsearched portion. A message appears when the entire document has been searched.
These controls allow you to specify the string or expression that will be matched.
Reuse one of the last 20 search strings by selecting it from this dropdown list, or type a new text string or expression to find.
[string with wildcards]
If you want to use wildcards such as asterisks (*) and question marks (?) in your search string, 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 expressions.
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.
Click this button to find the next instance of the Find what string within the search scope chosen in Look in.
These controls allow you to specify what will be inserted in the place of the matched string or expression.
To replace instances of the Find what string with another string, enter the replacement string in this field. To delete instances of the Find what string, leave this field blank. Select the drop-down list to display the last 20 items entered. To include regular expressions in the Replace with string, click the Use check box and select the Regular Expressions option.
This triangular button next to the Replace with field becomes available when the Use check box is selected in Find Options and Regular Expressions appears in the drop-down list. Click this button to display a list of regular expressions, depending upon the Use option selected. Choosing any item from this list adds it to the Replace with string.
Choose this button to replace the current instance of the Find what string with the Replace with string, and find the next instance within the Look in scope.
Choose this button to replace all instances of the Find what string with the Replace with string, in all files within the Look in scope.
Set the Look in scope to include only those files that you want to modify.
The option chosen from the Look in drop-down list determines whether Quick Replace searches only in currently active files.
Select a predefined search scope from this list.
This option is available when text is selected in the code editor. Searches only the selected text in the currently active document.
The name of this option indicates the location of the insertion point in the code editor. Searches within the current procedure, module, paragraph, or code block.
This option is available when a document is open in an editor. Searches only the active document for the Find what string.
This option is available when a searchable tool window, such as the View in Browser window, has focus. Searches all content displayed in this window for the Find what string. Replace and Replace All commands are not available.
All Open Documents
Searches all files currently open for editing as if they were one document. When the starting point of the search is reached in the current file, the search automatically moves to the next file and continues until the last open file has been searched for the Find what string.
Searches all files in the active project as if they were one document. When the starting point of the search is reached in one file, the search continues in the next until the last file in the project has been searched.
You can expand or collapse the Find Options section. The following options can be selected or cleared:
Only displays instances of the Find what string that are matched both by content and by case. For example, a search for "MyObject" with Match case selected will return "MyObject" but not "myobject" or "MYOBJECT."
Match whole word
Only displays instances of the Find what string that are matched in complete words. For example, a search for "MyObject" will return "MyObject" but not "CMyObject" or "MyObjectC."
When selected, files are searched from the insertion point to the top of the file.
Search hidden text
When selected, the search will also include concealed and collapsed text, such as the metadata of a design-time control; a hidden region of an outlined document; or a collapsed class or method.
Indicates how to interpret special characters entered in the Find what or Replace with text boxes. The options include:
Special characters such as asterisks (*) and question marks (?) represent one or more characters. For a list, see Wildcards (Visual Studio).
Special notations define patterns of text to match. For a list, see Regular Expressions (Visual Studio).
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