Find and replace text in solution
You can search and replace text in the entire solution, project, any directory with its nested hierarchy, or in any scope. Explore search results in the preview tab or in the Find window.
Find text in solution
If you want to search only specific part of your solution, select the corresponding node in the Solution Explorer.
Press Ctrl+Shift+F or choose
.In the Find in Files dialog, enter the search string.
If necessary, specify the search options.
You can click
or press Alt+Down to show the list of recent search entries.
To search for a multi-line fragment, click
in the search field or press Ctrl+Shift+Enter
To return to a single-line mode, press Backspace.
To restrict your search by file types, select File mask, and then choose the desired mask or specify a new one using wildcards:
*
to substitute a set of any characters,?
to substitute a single character,!
to exclude files. Note that!
should go first in a particular file name pattern, for example,!*.xml
You can specify multiple file masks, delimited with commas (for example,
*.xml,a?c.sql,!*.html
).Note also, that negated pattern (for example,
!*.min.js
) has implicit inclusion pattern*
. This allows avoiding such constructs as*, !*.min.js
for every file except minified javascript).If there is no search text and this checkbox is selected, JetBrains Rider will find all files matching the specified mask, regardless of their contents.
To restrict your search by a project, directory or specific scope, use the selector under the search field.
When invoked for the second (and subsequent) time, the dialog opens with the scope that has been selected previously. For example, if the scope has been Directory, the next time you invoke the dialog, the scope again will be Directory.
Results that match your query are listed as you type. When the query is complete, you can study the results:
Press Up/Down to select matching strings and study their context in the preview pane.
Edit code right in the preview pane as it is a functional editor where actions such as Ctrl+F or Alt+Enter are available.
You can select text and press Ctrl+Shift+F to start a new search right from the preview pane.
Press Enter to open the selected result in the editor.
Click Open in Find Window Ctrl+Enter to see all of the results in the Find window.
If the search takes too much time, click Background in the search progress window. In this case the search progress is indicated in the Status bar.
In contrast to other navigation and search commands, the results of Find in Files Ctrl+Shift+F are by default displayed in the same tab of the Find window. If you want the results of previous textual searches to be preserved in different tabs, select Open Results in New Tab in the bottom left corner of the Find in Files popup:
![JetBrains Rider: Open results in new tab JetBrains Rider: Open results in new tab](https://resources.jetbrains.com.cn/help/img/rider/2024.2/open_results_in_new_tab.png)
Replace text in the solution
Press Ctrl+Shift+R or select
from the main menu.In the Replace In Path dialog, specify the search and replace strings, search options, and the scope.
If you specify the search or replacement text through a regular expression, use the
$n
format in back references (to refer to a previously found and saved pattern).To use a backslash character
\
in a regular expression, escape the meaningful backslash by inserting three extra backslashes in a preposition:\\\\
.
You can view and analyze the matching occurrences the same way as with the search. Note the if you click Open in Find Window Ctrl+Enter, replace commands will be still available for the results.
Click Replace All to replace all matching occurrences or Replace to replace items one by one.
Toggle between Find and Replace
To switch from the Find in Files to Replace In Path window, press Ctrl+Shift+R.
To switch from the Replace In Path to Find in Files window, press Ctrl+Shift+F.
Search and replace options
| Show the history of the recent entries. |
Clear the search field. | |
| Enable entering the search string in several lines. Even without this option, you can search for multiline matches with regular expressions and escape characters. |
| Distinguish between upper and lowercase letters while searching. |
| Search for whole words only, that is, for character strings separated with spaces, tabs, punctuation, or special characters. This option is unavailable if Regular expressions is selected. |
| Process the search query as a regular expression. |
| Invoke the list of additional options, for example to confine the search to comments or string literals. |
| When replacing strings, use the casing of each occurrence for replacements. For example, when replacing This option is unavailable if Regular expressions is selected. |