Difference between revisions of "IDE Window: Find"

From Free Pascal wiki
Jump to navigationJump to search
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{IDE Window: Find}}
 
{{IDE Window: Find}}
  
If this dialog is invoked by Ctrl+F or by Search > Find then it the replace buttons and options are disabled.
+
If this dialog is invoked by Ctrl+F or by menu item "Search > Find" then the replace buttons and options are disabled.
  
If this dialog is invoked by Ctrl+R or by Search > Replace then the replace options will be enabled.
+
If this dialog is invoked by Ctrl+R or by "Search > Replace" then the replace options will be enabled.
  
 
* Text to Find
 
* Text to Find
 
* Replace With
 
* Replace With
  
The above two comboboxes contain the last searched texts and replace patterns. Cursor Down will go back in history and fetch the last text to find.
+
The above two comboboxes contain the last searched texts and replace patterns. Down-key will go back in history and fetch the last text to find.
  
 
'''Hint''':
 
'''Hint''':
Line 15: Line 15:
 
== Options ==
 
== Options ==
  
* Case sensitive - distinguish lower case and upper case (a and A)
+
* Case sensitive - distinguish lower case and upper case ('a' and 'A')
* Whole words only - The found text must start at a word start and end at a word end
+
* Whole words only - the found text must start at a word start and end at a word end
* Regular Expressions - see [[IDE regular expressions]]
+
* Regular expressions - treat texts as [[IDE regular expressions]]
* Multi line - not implemented yet
+
* 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 can not 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)
 
* Prompt on replace - ask before replacing (only enabled if replacing)
  
 
== Origin ==
 
== Origin ==
  
* From Cursor - start search at cursor. If direction is forward, it searches till the end of the file
+
* From Cursor - start search at cursor. If direction is forward, it searches till the end of the file.
* Entire Scope - If direction is forward it starts searching at the beginning of the file and searches till the end.
+
* Entire Scope - starts search at the text edge (at the beginning for forward search, at the very end for backward search)
  
 
== Scope ==
 
== Scope ==
Line 37: Line 42:
 
* Forward search - search top to bottom. Each line is searched from left to right.
 
* Forward search - search top to bottom. Each line is searched from left to right.
 
* Backward search - search bottom to top. Each line is searched forward - left to right.
 
* Backward search - search bottom to top. Each line is searched forward - left to right.
 
== Regular Expressions ==
 
 
=== Special Chars in Search Term ===
 
 
If you checked Regular Expression, you can use the following special chars in the search term
 
(list is not complete)
 
 
;\\: Matches a single \
 
;\n: Matches a newline
 
;\(: Matches a normal Bracket (
 
;(): Remembers the text matched. See $n in next section
 
 
=== Special Chars in Replace Term ===
 
 
If you checked Regular Expression, you can use the followin special chars in the replace term
 
 
;\\: Inserts *one* normal backslash
 
;$n ${n}: Where n is a number between 1 and 15. Inserts a copy the part of the found text matching the nth  pair of bracket "()" in the search term (eg $1 for the first char after foo, if the search term was "foo(.)" )
 
;\n: Inserts a Linebreak
 
;\l \u: Lower or Uppercases the *next* Char. Use this in front of $n. \u$1 Will insert the match from the first brackets, but with it's first char made uppercase
 
;\L \U: Lower or Uppercase the *full* text of the next $n. The $n must follow immediately
 

Revision as of 12:19, 3 July 2015

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

If this dialog is invoked by Ctrl+F or by menu item "Search > Find" then the replace buttons and options are disabled.

If this dialog is invoked by Ctrl+R or by "Search > Replace" then the replace options will be enabled.

  • Text to Find
  • Replace With

The above two comboboxes contain the last searched texts and replace patterns. Down-key will go back in history and fetch the last text to find.

Hint: You can choose, whether the IDE starts the dialog with the word at the cursor in the source editor or with a blank field in Environment -> Editor Options -> General -> Find text at cursor

Options

  • Case sensitive - distinguish lower case and upper case ('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 can not 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 cursor. If direction is forward, it searches till the end of the file.
  • Entire Scope - starts search at the text edge (at the beginning for forward search, at the very end for backward search)

Scope

  • Global - search in whole file
  • Selected Text - limit the search to the selected text

Hint: To search multiple files use 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 forward - left to right.