ReSharper Web Help

ReSharper | Find | Search with Pattern

This dialog box helps create a custom code pattern, search for it and replace it. Depending on your goals, you can open Search with Pattern dialog box in two modes:

Find Mode

By default the Search with Pattern dialog box opens in Find mode. All controls in this dialog box can be divided into logical groups.


Search with Pattern
Item Description

Menu bar

This area contains menu items.

Find

Click this button to switch to the Find mode.

Replace

Click this button to switch to the Replace mode.

Open Catalogue Open Catalog

Click to open the Pattern Catalog dialog box and look through the list of recently created and saved patterns.

Recent Search Recent Searches

Click to expand the list with recently used custom patterns.

Search area

This area contains controls that allow you to create a custom pattern and specify search options.

Search pattern

In this area enter your own search pattern using placeholders and plain text.

Look in

Use the drop-down list to specify the search scope. Several scopes are provided:

  • Entire Solution
  • Current Project
  • Current File

Match similar constructs

Use this control to specify whether to match similar constructs.

ReSharper considers following constructs as similar:

  • 1. Single-line statement and single-line statement that is enclosed in braces.
  • 2. Binary expressions as they are specified in the pattern and in reverse order.
  • 3. Expressions as they are specified in the pattern and expressions with different order of operands.
  • 4. Expressions where operands are enclosed in parentheses and expressions where operands are not enclosed.
  • 5. Postfix and prefix increment operators.
  • 6. Methods with different access modifiers.

Placeholder area

This area contains controls that help you create placeholders and manage them.

Add Placeholder Add Placeholder

Click this button to create new placeholder. There are 5 types of placeholders:

  • Argument
  • Expression
  • Identifier
  • Statement
  • Type

After you choose the desired type, the Create/Edit Placeholder dialog box opens.

The following controls can be used in this dialog box:

  • Name - specify the placeholder name (for all placeholders).
  • Limit minimal number of arguments/statements - define minimum number of placeholder occurrences (for argument and statement placeholders)
  • Maximal - define maximum number of placeholder occurrences (for argument and statement placeholders)
  • Expression type/Type - select an item from the drop-down list to specify the type of placeholder (for expression and type placeholders)
  • Or derived type - select this check box to match expressions or types which have chosen type or its derived types (for expression and type placeholders)
  • Identifier name regexp - define regular expression for identifier name (for identifier placeholder)
  • Case sensitive - specify whether the identifier is case sensitive (for identifier placeholder)

Edit Placeholder Edit

Click this button or double-click at the placeholder name to edit the selected placeholder using the Create/Edit Placeholder dialog box.

Remove Placeholder Remove

Click this button to remove the selected placeholder.

Command buttons

Command buttons that are available in this dialog box and are used to initiate immediate actions.

Find

Click this button to perform your search.

Save

Click this button to save current pattern to the catalog.

Close

Click this button to close the Search with Pattern dialog box.

Replace Mode

Most controls in Replace mode are completely the same as in Find mode. Controls that only appear in Replace mode are described below:


Search with Pattern
Item Description

Replace area

This area contains controls that allow to create a replace pattern and specify actions after the replacement.

Replace pattern

In this area enter a replace pattern using placeholders and plain text.

Format after replace

Specify whether to apply formatting to code.

Shorten references

Specify whether to replace fully qualified names with short names.

Command buttons

Command buttons that are available in this dialog box and are used to initiate immediate actions.

Replace

Click this button to find pattern occurrences and specify which of them to replace.

See Also

Procedures

Reference

External Links