AblebitsRegexReplace function

The AblebitsRegexReplace function searches for a match with the specified regular expression in a cell, and replaces it with the specified characters.

For example:

=AblebitsRegexReplace(A1, "(\d{3}-\d{3}-\d{4})", "phone number") searches for a match with the regular expression (\d{3}-\d{3}-\d{4}) in the A1 cell and replaces it with the 'phone number' string.

Tip. For the regular expression language details, please refer to the guide: Regular Expression Language - Quick Reference
Note. Formulas created with this function will work only on machines with installed Ultimate Suite for Excel. If the workbook is opened on another computer where Ultimate Suite is not installed, the result will be lost.
Tip. You can find the complete list of custom functions on the Ablebits functions for Excel page.

Syntax

AblebitsRegexReplace(reference,regular expression,replacement)

The AblebitsRegexReplace function syntax has the following arguments:

  • reference
    Required. The cell reference that contains data to search for a match with the regular expression.
  • regular expression
    Required. The regular expression.
  • replacement
    Required. The value that should replace the match with the regular expression.

Remarks

  • The AblebitsRegexReplace function is used by the Regex Tools add-in when you select Replace option and the check the Insert result as formula box before pasting the result.

To learn more about the Regex Tools add-in and other custom Ablebits Regex functions, please see: