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


The Replace command is used to locate a specific pattern in a file and replace it 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 match, in addition, the replace pattern may be empty. In the latter case, found pattern occurrences are removed from the document.

Complexity: linear-time.

Find & Replace Operations

When you press the Replace button for the first time, Hex Editor Neo starts searching for a pattern. When pattern is located, the cursor is moved to the beginning of the pattern and a Find & Replace Window is displayed again. Now you have a choice of pressing the Find Next button to skip this match and search for another, or pressing the Replace button to replace this match and continue searching.

The direction of the next search is governed by the Search up or Search down option.

When there are no more matches, the message box is displayed.

Regular Expressions

The Replace command fully supports regular expressions. To search using regular expressions, select either “ANSI string” or “UNICODE String” 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.

If the match is found, the cursor is moved to the beginning of the matched expression or sub-expression. When you use the Find Next command to find the next match, the search is started from the next cell, not the end of the matched expression. If you press the Replace button, the matched expression or sub-expression is replaced with a replace pattern.

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.


Take the following limitations into account:

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


Scripts may use the IDocumentView.replaceAsync and IDocumentView.replaceRegExpAsync methods to execute this operation.