Rgx.SUBSTITUTE function
Searches a string (or a rectangular array/range) for a substring that matches a regular expression pattern (or a rectangular array/range of patterns).
Replaces the matched substring(s) with New_Text.
Rgx.SUBSTITUTE is a multi-threaded, non-volatile array function.
Rgx.SUBSTITUTE Syntax
Rgx.SUBSTITUTE(Text, RegExp, New_Text, Nth, Case_Sensitive)
The first 2 parameters are required; the last 3 parameters are optional.
Text (required)
Constant, range or array containing the string(s) to be searched for the Regular Expression Patterns.
RegExp (required)
Specifies the Regular Expression(s) to be used when matching String. If String is an array or a multi-cell range then RegExp must contain a matching set (same number of rows and columns as String) of regular expressions
New_Text (optional – default 0)
The Text(s) used to replace the substring(s) that match the Regular Expression Pattern. If omitted the matching substrings are removed.
Nth (optional – default 0)
If >0 replaces only the Nth match of the substring. If 0 all matches found are replaced.
Case_Sensitive (optional)
TRUE to make the pattern-matching case-sensitive. The default is FALSE.
Rgx.SUBSTITUTE Examples
|