Sometimes you need to find not just usages of a certain symbol or occurrences in text that match some regular expression, but pieces of source code that match a certain pattern. For example, to find code smells specific for your project or to find pieces of code that need to be refactored. ReSharper provides a powerful tool that helps find such custom code fragments.
- On the main menu, choose ReSharper | Find | Search with Pattern. The Search with Pattern dialog box opens.
Define a pattern in the Search pattern text area.
NotePay attention, that when you use a placeholder, its name should be enclosed with dollar signs (use the syntax $xx$, where xx represents placeholder name),whereas when you create a new placeholder, you should omit these special symbols.
- Specify the search scope using the Look in list.
- Click Find to start the search.
- Search results are shown in the Find Results window.
If the results do not actually include what you are looking for, you can quickly modify the pattern and invoke the search process once again. To do that, click Change Search Pattern on the toolbar of the Find Results window.