NxReplace - Regular Expression (regex) Replace Function

Returns the modified string after performing match/replace on the given string.


NxReplace(string, pattern, Value, ignore_case, Global)

is the input string to process.
is the regular expression (PERL-style) (e.g., "^\d\w{1,2}.*$").
is the value to replace the match with. If missing or omitted, an empty string is used.
is a flag to instruct the matching function on whether to ignore letter-case or not. If missing, ignore_case is set to TRUE.
is a flag to instruct the function on whether to match and replace the first occurrence (FALSE) or all the matches (TRUE). If missing or omitted, global is set to TRUE.


  1. Currently, NxReplace supports regular expressions using the PERL-syntax.
  2. If the pattern input is omitted or missing, NxReplace returns a #VALUE! error.
  3. If the value input argument is omitted or missing, NxReplace removes all occurrences of the pattern from the string.


Formula Description (Result)
=NxReplace("R3epl4ace3 al2l1 d1ig1it7s5","(\d)+","") Replace all digits
=NxReplace("This test should replace Three t's","t","a",FALSE) This aesa should replace Three a's

Files Examples

Related Links


  • Jeffrey E.F. Friedl (2006). Mastering Regular Expressions (3rd edition). Oreilly Media. ISBN 0-596-52812-4.


Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful