Finding and replacing text in the current file

The Find/Replace dialog

The Find/Replace dialog opened with the menu entry EditFind/Replace... (Ctrl+F) enables you to define "search for" or "search for and replace" operations on the current document. The find works on multiple lines, which means a find match can cover characters on more than one line. To insert a new line in the find or replace text area press CTRL + Enter instead of Enter. The replace operation can bind Perl 5 regular expression group variables ($1, $2, etc.) from the find match. For example to replace the tag with attributes called tag-name with the tag tag-name1 use as text to find <tag-name(\s+)(.*)> and as replace text <tag-name1$1$2>.

  • Find occurrences of a word or string of characters including white spaces represented on a line or on multiple lines and highlight the position in the editor.

  • Replace occurrences of target defined in the Text to find area with a word or string of characters, including white spaces, that can be on a line or on multiple lines, defined in the Replace with area.

  • Replace all occurrences of a word or string of characters including white spaces that can be on a line or on multiple lines.

Figure 4.1. Find/Replace Dialog

Find/Replace Dialog

Complete the dialog as follows:

Text to find

The target character string to search for. The string can be on a line or on multiple lines. Special characters like newline and tab can be inserted using the contextual menu.

You can search for Unicode characters specified in the \uNNNN format. Also, hexadecimal notation (\xNNNN) and octal notation (\0NNNN) can be used. Note that in this case you have to check the Regular expression checkbox. For example to search a space character you can use \u0020 code.

Replace with

The character string with which to replace the target. The string for replace can be on a line or on multiple lines. Special characters like newline and tab can be inserted using the contextual menu.

Unicode characters can also be used in the Replace with area.

The Find and Replace history buttons

The last find and replace operations history is available using the History buttons from the top of the find or replace text area.

The character string with which to replace the target. It may contain regexp group markers if the search expression is a regular expression and the regular expression checkbox is checked.

Direction

Specify if the search direction is from current position to end of file (forward direction) or to start of file (backward direction).

Scope

Specify if the search is executed on all file or only on the lines that were selected when the dialog was invoked. If the selection was on a single line the search is executed on all the file.

Find

Execute a find operation for the next occurrence of the target and stop.

Replace

Execute a replace operation for the target followed by a find operation for the next occurrence.

Replace all

Execute a replace operation in the entire scope of the document.

Replace to end

Execute a replace operation starting from current target until the end of the document, in the direction specified by the current selection of the Direction switch (forward or backward).

Case sensitive

When checked, operations are case sensitive.

Whole words only

When checked only whole occurrences of a word will be included in the operation.

Search also in tags

When checked, operation will include content of the start and end tags of the XML elements.

Incremental

When checked, search operation is started for every letter typed in or deleted. The first match that obeys the checked conditions will be highlighted.

Regular expression

When checked allows using any regular expression in PERL syntax.

Wrap around

Continues the find from the start (end) of the document after reaching the end (start) if the search is in forward (backward) direction.