Edit online

Find/Replace Dialog Box

To open the Find/Replace dialog box, use the Find/Replace action that is available in the Find menu, on the toolbar, or by pressing Ctrl + F (Command + F on macOS). It is also invoked by the Find/Replace contextual menu action found in certain views.

You can use the Find/Replace dialog box to perform the following operations:
  • Replace occurrences of target defined in the Find area with a new fragment of text defined in Replace with area.
  • Find all the occurrences of a word or string of characters (that can span over multiple lines) in the document you are editing. This operation also takes into account all the whitespaces contained in the fragment you are searching for. The Find/Replace dialog box counts the number of occurrences of the text you are searching for and displays it at the bottom of the dialog box, above the Close button. This number is also displayed in the Results view view after you click the Find All button.
The find operation works on multiple lines, meaning that a find match can cover characters on multiple lines of text. To input multiple-line text in the Find and Replace with areas, do one of the following:
  • Press Ctrl + Enter (Command + Enter on macOS) on your keyboard.
  • Use the Insert newline contextual menu action.

You can use Perl-like regular expressions syntax to define patterns. A content completion assistance window is available in the Find and Replace with areas to help you edit regular expressions. It is activated every time you type \(backslash key) or on-demand if you press Ctrl + Space on your keyboard.

The replace operation can bind regular expression capturing groups ($1, $2, etc.) from the find pattern.

Tip: To replace the <tag-name> start tag and its attributes with the <new-tag-name> tag use as Find the expression <tag-name(\s+)(.*)> and as Replace with the expression <new-tag-name$1$2>.

Find/Replace Dialog Box

Figure 1. The Find/Replace Dialog Box

The Find/Replace dialog box contains the following options:

Find text area box

This is where you enter the character string to search for. You can search for Unicode characters specified in the \uNNNN format. Also, hexadecimal notation (\xNNNN) and octal notation (\0NNNN) can be used. In this case you have to select the Regular expression option. For example, to search for a space character you can use the \u0020 code.

You can use the History button to select from a list of the most recently used expressions. Use the Clear history action from the bottom of the lists to remove these expressions.

Replace with text area box
The character string with which to replace the target. The string for replace can be on a line or on multiple lines. It can contain Perl notation capturing groups, only if the search expression is a regular expression and the Regular expression option is selected.
Note: Some regular expressions can indefinitely block the application. If the execution of the regular expression does not end in about 5 seconds, the application displays a dialog box that allows you to interrupt the operation.
Tip: Special characters such as newline and tab can be inserted in the Find and Replace with text boxes using dedicated actions in the contextual menu (Insert newline and Insert tab).

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

You can use the History button to select from a list of the most recently used expressions. Use the Clear history action from the bottom of the lists to remove these expressions.

XPath
The XPath 2.0 expression you input in this combo is used for restricting the search scope. The cursor position does not affect the result of the XPath evaluation. The context of the XPath expression evaluation from the Find/Replace dialog box is the XML document root. The XPath is used for determining the intervals to be searched from the document, so the XPath result must be a node-set.
Tip: You can use the Content Completion Assistant to help you input XPath expressions that are valid in the current context. See Working with XPath Expressions for more information and some common examples of how to write XPath expressions.

Clicking the XPath Options button opens a preferences page where you can configure some XPath-related options.

Direction
Specifies if the search direction is from current position to end of file (Forward) or to start of file (Backward).
Scope
Specifies whether the Find/Replace operation is executed over the entire content of the edited document (All option), or over the selected content/lines.
Options section
Case sensitive
When selected, the search operation follows the exact letter case of the text entered in the Find field.
Incremental
The search operation is started every time you type or delete a letter in the Find text box.
Wrap around
When the end of the document is reached, the search operation is continued from the start of the document, until its entire content is covered.
Ignore extra whitespaces
If selected, the application normalizes the content (collapses any sequence of whitespace characters into a single space) and trims its leading and trailing whitespaces when performing the search operation. This is helpful when searching for spaced-separated words since line breaks and indentation between words will not affect the results. This option is automatically disabled if the Regular expression option is selected.
Whole words only
Only entire occurrences of a word are included in the search operation. This option is automatically disabled if the Regular expression option is selected.
Regular expression
When this option is selected, you can use regular expressions in Perl-like regular expressions syntax to look for specific pieces of text.
  • Dot matches all - A dot used in a regular expression also matches end of line characters.
  • Canonical equivalence - If selected, two characters will be considered a match if, and only if, their full canonical decompositions match. For example, the ã symbol can be inserted as a single character or as two characters (the a character followed by the tilde ~ character). This option is not selected by default.
Find button
Executes a find operation for the next occurrence of the target. It stops after highlighting the find match in the editor panel.
Replace/Find button
Executes a replace operation for the target followed by a find operation for the next occurrence.
Replace button
Executes a replace operation for the target without going to the next occurrence.
Find All button
Executes a find operation and displays all results in the Results view view.
Replace All button
Executes a replace operation in the entire scope of the document.
Replace to End button
Executes 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).