Skip to content

Find text

Find text in the current file

To find text in a file that's currently opened in the editor:

  • Press Ctrl+F.

Or:

  • Select Edit > Find > Find on the main menu.

A toolbar appears at the top of the window.

Options

  • To perform case sensitive searches select Match Case .

  • To match whole words only select Words .

  • To interpret search criteria as a regular expression select Regex .

  • To limit the search to a part of the code, for example comments, select the pop-up menu and choose from the list.

  • To toggle the use of selected text as the scope of the search, select In Selection .

To perform a search:

  • Enter the search criteria in the search box: all the search criteria occurrences are immediately highlighted in the text.

The number of matches is shown in the right part of the toolbar.

  • To create multi-line search criteria select New Line or press Ctrl+Shift+Enter.

  • To clear the search criteria select the "X" icon .

  • To use previous search criteria select Search History and choose from the list.

To use existing text as the search criteria:

  1. Select the text to use as search criteria.
  2. Press Ctrl+F.

    Or:

    Select Edit > Find > Find on the main menu.

Use the results

  • To move to the previous match select Previous Occurrence .

  • To move to the next match select Next Occurrence .

  • To add the next match to the selection, select Add Selection for Next Occurrence

  • To subtract the current match from the selection, select Unselect Occurrence .

  • To select all the matches select Select All Occurrence .

  • To replace all the selected matches at once, just enter the replacement text. You can obtain similar results with multiple string selection.

Info

For more information about searching within a file see the IntelliJ IDEA documentation.

Find text in the project, in a module, in a directory or in a scope

To find text in all the files contained in the project, in a project module, in a directory or in a scope:

  • Press Ctrl+Shift+F.

Or:

  • Select Edit > Find > Find in Files on the main menu.

The Find in Files window appears.

Options

  • To perform case sensitive searches select Match Case .

  • To match whole words only select Words .

  • To interpret search criteria as a regular expression select Regex .

  • To limit the search to files with a given extension, check File mask and choose the extension from the list.

  • To limit the search to a part of the code, for example comments, select Show Filter Popup and choose from the list.

  • To set the scope of the search, choose between In Project, Module, Directory and Scope.

    • If you choose Module, select the module from the list.

    • If you choose Directory:

      • Enter the directory path

      Or:

      • Select the ellipsis button or press Shift+Enter to select the directory path.

      • To toggle recursive search in sub-directories, select Search recursively in subdirectories .

    • If you choose Scope:

      • Select the scope from the list.

      • To manage scopes select the ellipsis button or press Shift+Enter.

      More about scopes in the IntelliJ IDEA documentation.

  • To pin the window select Pin Window .

  • To show tab option select Show Tab Option .

  • To open the window in the Find window press Ctrl+Enter or select .

Search

To perform a search:

  • Enter the search criteria in the search box: search results appear below.

  • To create multi-line search criteria select New Line or press Ctrl+Shift+Enter.

  • To clear the search criteria select the "X" icon .

  • To use previous search criteria select Search History and choose from the list.

Use the results

The number of files and the number of matches are displayed above the search box.

Matches are highlighted inside the results.
The name of the file and the line number is shown to the right of each result.
A preview of the result in the context of the file is displayed below the results.

  • To jump to the line of code corresponding to a result, double-click the result.

Info

For more information about finding in path see the IntelliJ IDEA documentation.