IDE Window: Find

From Lazarus wiki
Jump to navigationJump to search

Deutsch (de) English (en) suomi (fi) français (fr)

Navigation

If this dialog is invoked by CTRL+F or Cmd+F, or from the Lazarus IDE Main Menu > Search > Find menu item, then the replace option is disabled and the associated buttons are not visible. The replace options can be enabled by checking the "Replace with" checkbox.

To search every file open in the editor, press CTRL+ Shift+F or Cmd+ Shift+F, or from the Lazarus IDE Main Menu > Search > Find in files ... menu item, Lazarus will search all open files and present either a list of all occurrences of the search string in all files, or If there are no hits, a blank search result is returned.

If this dialog is invoked by CTRL+R or Cmd+R, or from the Lazarus IDE Main Menu > Search > Replace menu item, then the replace option will be enabled.

If this dialog is invoked by CTRL+ Shift+R or Cmd+ Shift+R (this feature is not available from the main menu), then the Replace in All Open Files option will be enabled. It will find every occurrence of the search string and allow either selecting specific entries in files, or all occurrences in all open files.

Search Find 2 0 10.jpg Search Replace 2 0 10.jpg

Usage

  • Text to find
  • Replace with

These two fields contain the last searched text and replacement text (if any). will go back in history and will go forward in history and recall the previous search text and replacement text.

Note-icon.png

Tip: You can choose whether the Lazarus IDE starts the dialog with the word at the cursor in the source editor or with a blank field in Main Menu > Tools > Options > Editor > General > Miscellaneous > Find text at cursor.

Options

  • Case sensitive - distinguish lowercase and uppercase (eg a and A).
  • Whole words only - the found text must start at a word start and end at a word end.
  • Regular expressions - treat texts as IDE regular expressions.
  • Multi line - the search does not stop at line ends or in other words: the found text can contain multiple lines. You can paste/copy multiple lines from the source editor to the Find field and you will see the line endings. These line endings cannot be created by normal keys. When searching with regular expressions you can use \+n (backslash plus n) as marker for line end characters. This also activates "multi-line" reg-expression option: for example, reg-expression "begin.*Application" will find such text:
 begin
   Something;
   Application
  • Prompt on replace - ask before replacing (only enabled if replacing).

Origin

  • From Cursor - start search at the cursor. If direction is forward, it searches until the end of the file.
  • Entire Scope - start search at the text edge (at the beginning for forward search, at the end for backward search)

Search Scope

  • Global - search in the whole file.
  • Selected Text - limit the search to the selected text.
Note-icon.png

Tip: To search multiple files at the same time, use Main Menu > Search > Find in files.

Direction

  • Forward search - search top to bottom. Each line is searched from left to right.
  • Backward search - search bottom to top. Each line is searched backward from left to right.