This dialog box helps create a custom code pattern, search for it and replace it. Depending on your goals, you can switch two modes in the Search with Pattern dialog box:
For more information, see Structural Search and Replace.
Find mode
By default, the
Search with Pattern dialog box opens in the
Find mode.
The controls that are available in this mode are described in the table below.
| Item | Description |
|---|---|
| Menu bar | This area contains menu items. |
| Language selector | Allows choosing a programming language of the pattern. |
| Find | Click this button to switch to the Find mode. |
| Replace | Click this button to switch to the Replace mode. |
|
| Click to open the Custom Patterns page of the ReSharper options and look through the list of existing patterns. |
|
| 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:
|
| Match similar constructs |
Use this control to specify whether to match similar constructs.
ReSharper considers following constructs as similar:
|
| Placeholder area | This area contains controls that help you create placeholders and manage them. |
| Add Placeholder |
Click this button to create new placeholder. There are 5 types of placeholders:
After you choose the desired type, the
Create/Edit Placeholder dialog box opens.
The following controls can be used in this dialog box:
|
|
Edit |
Click this button or double-click at the placeholder name to edit the selected placeholder using the Create/Edit Placeholder dialog box. |
|
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. To access the pattern catalog, open the Custom Patterns page of the ReSharper options. |
|
Close |
Click this button to close the Search with Pattern dialog box. |
Replace mode
Most controls in the Replace mode are completely the same as in the Find mode.
The table below describes additional controls that appear in the Replace mode:
| 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. |

