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)

string is the input string to process.

pattern is the regular expression (PERL-style) (e.g. "^\d\w{1,2}.*$").

Value is the value to replace the match with. If missing or omitted, an empty string is used.

ignore_case is a flag to instruct the matching function whether to ignore letter-case. If missing, ignore_case is set to TRUE.

Global is a flag to instruct the function 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 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 occurrence 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


  • Jeffrey E.F. Friedl (2006). Mastering Regular Expressions (3rd edition). Oreilly Media. ISBN 0-596-52812-4.
Was this article helpful?
0 out of 0 found this helpful