Skip to content

regexprep

builtin · libnexusinterp/corefcn/regexp-proprietary.cc

: outstr = regexprep (string, pat, repstr)
: outstr = regexprep (string, pat, repstr, "opt1", …)

Replace every match of the regular expression pat in string with repstr.

In repstr, $N (digit 0 to 9) inserts token N (0 is the whole match), $<name> inserts a named token, and a backslash introduces the usual control escapes or quotes the next character.

Options are those of regexp; "once" replaces only the first match. string, pat and repstr may be cell arrays of strings; patterns are applied one after another.