The Find / Replace in Files dialog is opened from menu or from the toolbar button
Find / Replace in Files.
It enables you to define "search for" or "search for and replace" operations across a number
of files. The find works at line level, which means a find match cannot cover characters on
more than one line. 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 the expression <tag-name(\s+)(.*)> and as the
Replace with expression <tag-name1$1$2>.
The encoding used to read and write the files is detected from the XML header or from the
BOM. If a file does not have an XML header or BOM Oxygen uses by default the UTF-8
encoding for files of type XML, that is for files with one of the extensions:
.xml, .xsl, .fo,
.xsd, .rng, .nvdl,
.sch, .wsdl or an extension associated with the XML editor type.
For the other files it uses the encoding configured for
non-XML files.
You can cancel a long operation at any time by pressing the Cancel
button of the progress dialog displayed when the operation is executed.
Because the content of read-only files cannot be modified, the Replace
operation is not processing those files. For every such file, a warning message is displayed
in the message panel.
Find / Replace in Files
The dialog contains the following options:
- Text to 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 check the
Regular expression checkbox. For example, to search for a space
character you can use the \u0020 code.
- 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.
- Regular expression - When checked, it allows you to use
regular expressions in Perl 5 syntax. A content completion assistant window is available to
help you edit regular expressions. It is activated every time you type \(backslash
key) or on-demand if you press Ctrl-Space.
- XPath - The XPath 2.0 expression
you input in this combo is used to restrict the search scope.
The
content completion assistant helps you input XPath expressions,
valid in the current context.
- Enable XML search
options - When checked, the dialog is enlarged and the XML search options are
shown below. This option restricts the search domain to the checked XML component
types.
The supported XML component types are the following:
- Element names - Only the names are searched, without '<',
'/', '>', attributes or white-spaces. e. g.: <element />.
- Element contents - Search in the text content of XML
elements.
- Attribute names - Only the attribute names are searched,
without the leading or trailing white-spaces.
- Attribute values - Only the attribute values are searched,
without single quotes(') or double quotes("). e. g.: 'value' or
"value"
- Comments - Only the content of comments are searched, skipping
'<!--', '-->'. e. g.: <!--Comment content-->
- Processing Instructions (PIs) - Only the content are searched,
skipping '<?', '?>'. e. g.: <?processing instruction?>
- CDATA - Only the content are searched, skipping '<![CDATA[',
']]>'. e. g.: <![CDATA[cdata content]]>
- DOCTYPE - Only the content of the DOCTYPE section are
searched.
- 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: Please note that since searching in some XML component types is
performed only on their content skipping some of their headers / footers (see the list
above), even if all the XML component types are checked, some filtering is still
performed. To completely disable it you have to uncheck the option Enable XML
search options.
- Replace with - The character string with which to replace the
target. It may contain regular expression group markers if the search expression is a
regular expression and the Regular expression checkbox is
checked.
- Make backup files with extension - In the replace process Oxygen makes backup files of the
modified files. The default extension is .bak but you can change the
extension as you prefer.
- Selected project files - Searches only in the selected files of the
current opened project. Not displayed when dialog is started from contextual menu of DITA
Maps view and Archive Browser
view.
Note: The search is performed only on local files. If you have added to the project
remote files from an FTP or WebDAV server, these files are skipped.
- Project files - Searches in all files from the current project. Not
displayed when dialog is started from contextual menu of DITA
Maps view and Archive Browser
view.
- All opened files - Searches in all files opened in Oxygen (regular files or DITA Maps).
You are prompted to save all modified files before any operation is performed. Not displayed
when dialog is started from contextual menu of DITA
Maps view and Archive Browser
view.
- Current file directory - The search is done in the directory of the
file opened in the current editor panel. If there is no opened file, this option is disabled
in the dialog. Not displayed when dialog is started from contextual menu of DITA
Maps view and Archive Browser
view.
- Current DITA Map hierarchy - The search is done in all maps and
topics referenced by the current edited DITA Map. If Recurse referenced
maps option is checked, the references from the maps referenced in the main
DITA map are also searched in. If there is no opened DITA Map, this option is disabled in
the dialog. You are prompted to save all modified files before any operation is performed.
Displayed only when dialog is opened from DITA
Maps view.
- Opened archive - The search is done in archive opened in Archive Browser
view. Displayed only when dialog is opened from Archive Browser
view.
- Specified path - Chooses the search path.
- File filter - Narrows the scope of the operation only to the files
that match the given filters.
- Recurse subdirectories - When checked, the search is performed
recursively in the sub directories found in the specified directory path.
- Include hidden files - When checked, the search is performed also
in the hidden files.
- Include archives - When checked, the search is also done in all individual file entries from all supported ZIP-type archives.
- Show separate results for each search expression - When checked,
the application opens a new tab to display the result of each new search expression. When
the option is unchecked, the search results are displayed in the Find in Files tab,
replacing any previous search results.
- Find All - Executes a find operation and returns the result list to
the message panel.
- Replace All - Replaces all occurrences of the target contained in
the specified files.
CAUTION:
Use this option with caution. Global search and replace across all project
files does not open the files containing the targets, nor does it prompt on a per occurrence
basis, to confirm that a replace operation must be performed. As the operation simply matches
the string defined in the find field, this may result in replacement of matching strings that
were not originally intended to be replaced.