Bagikan melalui


Quick Find, Find and Replace Window

Quick Find allows you to search the code of one or more open documents for a string or expression. The selection moves from match to match, allowing you to review each match in its surrounding context.

Note

The matches found are not listed in the Find Results window.

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

To display Quick Find

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

  2. Choose Quick Find.

    —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 Quick Find.

Quick Find 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.

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]

    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 then choose Wildcards.

    [regular expression]

    To instruct the search engine to expect regular expressions, select the Use check box under Find options and then choose Regular expressions.

  • Expression Builder
    This triangular button next to the Find what 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 wildcards or regular expressions, depending upon the Use option selected. Choosing any item from this list adds it into the Find what string.

  • Find Next
    Click this button to find the next instance of the Find what string within the search scope chosen in Look in.

  • Bookmark All
    Click this button to display blue bookmarks at the left edge of the code editor to indicate each line where an instance of the Find what string occurs.

Look in

The option chosen from the Look in drop-down list determines whether Quick Find searches only in currently active files.

  • Look in
    Select a predefined search scope from this list.

    Option

    Description

    Selection

    This option is available when text is selected in the code editor. Searches only the selected text in the currently active document.

    <Current Block>

    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.

    Current Document

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

    Current Window

    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.

    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.

    Current Project

    Searches all files in the current 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.

Find options

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

  • Match case
    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."

  • Search up
    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.

  • 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 asterisks (*) and question marks (?) represent one or more characters. For a list, see Wildcards (Visual Studio).

    Regular Expressions

    Special notations define patterns of text to match. For a list, see Regular Expressions (Visual Studio).

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

Quick Replace, Find and Replace Window

Find in Files, Find and Replace Window

Other Resources

Find and Replace Window

Finding and Replacing