Finding and Replacing Text in Multiple Files

The Find / Replace in Files dialog is opened from menu Find > Find / Replace in Files... 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:

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.