Qt Creator Manual

Finding and Replacing

To search through the currently open file:

  1. Press Ctrl+F or select Edit > Find/Replace > Find/Replace.
  2. Enter the text you are looking for.

    If the text is found, all occurrences are highlighted as you type.

  3. To go to the next occurrence, click , or press F3. To go to the previous occurrence click , or press Shift+F3.

You can restrict the search in the Find field by selecting one or several search criteria:

  • To make your search case sensitive, select .
  • To search only whole words, select .
  • To search using regular expressions, select . Regular expressions used in Qt Creator are modeled on Perl regular expressions. For more information on using regular expressions, see Detailed Description in the QRegExp Class Reference.

Note: If you have selected text before selecting Find/Replace, the search is conducted within the selection.

To replace occurrences of the existing text, enter the new text in the Replace with field.

  • To replace the selected occurrence and move to the next one, click or press Ctrl+=.
  • To replace the selected occurrence and move to the previous one, click .
  • To replace all occurrences in the file, click Replace All.

Advanced Search

To search through projects, files on a file system or the currently open file:

  1. Press Ctrl+Shift+F or select Edit > Find/Replace > Advanced Find > Open Advanced Find.
  2. Select the scope of your search:
    • All Projects searches files matching the defined file pattern in all currently open projects.

      For example, to search for previewer only in .cpp and .h files, enter in File pattern *.cpp,*.h.

    • Current Project searches files matching the defined file pattern only in the project you are currently editing.
    • Files on File System recursively searches files matching the defined file pattern in the selected directory.
    • Current File searches only the current file.
  3. Enter the text you are looking for and click Search.

    A list of files containing the searched text is displayed in the Search Results pane.

    • To see all occurrences in a file, double-click the file name in the list.
    • To go to an occurrence, double-click it.

Note: You can use Advanced Find also to search for symbols. For more information, see Finding Symbols.