NxReplace - Regular Expression (regex) Replace Function

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

Syntax

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 on whether to ignore letter-case or not. If missing, ignore_case is set to TRUE.
Global
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.

Remarks

  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.

Examples

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

References

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

Comments

Article is closed for comments.

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