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 (Meta F on OS
X).
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
white spaces contained in the fragment you are searching for.
Note: 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.
The
find operation works on multiple lines, meaning that a find match can cover
characters on more than one line of text. To input multiple-line text in the
Find and
Replace with areas, do one of the following:
- Press Ctrl Enter (Meta
Enter on OS X)
on your keyboard.
- Use the Insert newline contextual menu action.
You can use Perl-like regular
expressions syntax to define patterns. A content completion assistant 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 (Command Space on OS
X) on your keyboard.
The replace operation can bind regular expression capturing groups ($1,
$2, etc.) from the find pattern.
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>.
The dialog box contains the following options:
- Find - The target 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.
- Replace with - 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 block
indefinitely 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.
Note: Special characters like 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.
- The
History button - Contain lists of the last find and replace 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.
Note: The Content Completion
Assistant helps you input XPath expressions, valid in the current
context.
- 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 lines of text
(Only selected lines option). If the selection spans across
multiple lines, when you open the Find/Replace dialog box, the
scope is set to Only selected lines.
- Case sensitive - When checked, the search
operation follows the exact letter case of the text entered in the
Find field.
- Whole words only - Only entire occurrences of a
word are included in the search operation.
- Incremental - The search operation is started every time you type
or delete a letter in the Find text box.
- Regular expression - When this option is enabled, 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 enabled, 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
disabled by default.
- 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.
- Enable XML search options - This option is
only available when editing in Text mode. It provides access to a set
of options that allow you to search specific XML component types:
- Element names - Only the element names are included in the
search operation which ignores XML-tag notations ('<', '/', '>'), attributes or
white-spaces.
- Element contents - Search in the text content of XML
elements.
- Attribute names - Only the attribute names are included in the
search operation, without the leading or trailing white-spaces.
- Attribute values - Only the attribute values are included in
the search operation, without single quotes(') or double quotes(").
- Comments - Only the content of comments is included in the
search operation, excluding the XML comment delimiters ('<!--', '-->').
- PIs (Processing Instructions) - Only the content are searched,
skipping '<?', '?>'. e. g.: <?processing instruction?>
- CDATA - Searches inside content of CDATA sections.
- DOCTYPE - Searches inside content of DOCTYPE sections.
- Entities - Only the entity names are searched.
The two buttons Select All and Deselect
All allow a simple activation and deactivation of all types of XML
components.
Note: Even if you enable all options of the Enable XML search
options section, the search is still XML-aware. If you want to perform the
search over the entire file content, disable Enable XML search
options.
- Find All Elements - Available when
editing in Author mode, you can use this link to extend the search
scope to XML-specific markup (names and values of both attributes and elements).
- Find - Executes a find operation for the next occurrence of the
target. It stops after highlighting the find match in the editor panel.
- Replace - Executes a replace operation for the target followed by a
find operation for the next occurrence.
- Find All - Executes a find operation and displays all results in
the Results
view. The results are displayed in the Results view.
- Replace All - Executes a replace operation in the entire scope of
the document.
- Replace to End - 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).