Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

Replace All

This extremely powerful command can be used to locate all occurrences of one pattern and replace them with another pattern. The Find & Replace Window is used to specify both patterns, as well as a number of additional options. It is not required that the size of the search and replace patterns matches, in addition, the replace pattern may be empty. In the latter case, found pattern occurrences are removed from the document.

Complexity: linear-time (depends on the file's size and resulting number of noncontiguous matches).

Replace All Results

After all occurrences of the search pattern are found and replaced, the message box with a total number of replacements is displayed. If there were no matches, the message box with “No matches” text is displayed.

The Replace All command is always faster than a series of commands, such as Find All and Fill, or Find All and Delete. The latter command sequence is easily replaced with a Replace All command with an empty replace pattern.

Replace All command, as most other commands, creates an operation in the operation history.

Regular Expressions

The Replace All command fully supports regular expressions. To search using regular expressions, select either “ASCII string (char[])” or “UNICODE string (wchar_t[])” pattern type, enter the regular expression, make sure the Regular expression checkbox is checked and enter the sub-expression number you want to search for. Sub-expression 0 represents the expression itself.

A replace pattern may contain special characters. To tell Hex Editor Neo to treat a replace pattern specially, make sure its Regular expression checkbox is checked. If it is, the following restrictions apply:

  1. The type of the replace pattern automatically matches the type of the search pattern (encoded or UNICODE string).
  2. You are restricted to use sub-expression 0 for a search pattern (that is, the whole expression).

If you enable a regular expression mode for a replace pattern, but do not use any of the special characters, Hex Editor Neo will automatically turn this mode off when performing replace in order to achieve greater performance.

See the Replace Pattern Syntax topic for further information on supported syntax.

NOTE

Searching with regular expressions within a selection (either single-range, or multiple) is not supported.

Scripting

Scripts may use the IDocumentView.replaceAllAsync and IDocumentView.replaceAllRegExpAsync methods to execute this operation.