Function Reference
— Loadable Function: string = regexprep (string, pat, repstr, options)

Replace matches of pat in string with repstr.

The replacement can contain $i, which substitutes for the ith set of parentheses in the match string. E.g.,

          
            regexprep("Bill Dunn",'(\w+) (\w+)','$2, $1')
          

returns "Dunn, Bill"

options may be zero or more of

‘once’
Replace only the first occurrence of pat in the result.
‘warnings’
This option is present for compatibility but is ignored.
‘ignorecase or matchcase’
Ignore case for the pattern matching (see regexpi). Alternatively, use (?i) or (?-i) in the pattern.
‘lineanchors and stringanchors’
Whether characters ^ and $ match the beginning and ending of lines. Alternatively, use (?m) or (?-m) in the pattern.
‘dotexceptnewline and dotall’
Whether . matches newlines in the string. Alternatively, use (?s) or (?-s) in the pattern.
‘freespacing or literalspacing’
Whether whitespace and # comments can be used to make the regular expression more readable. Alternatively, use (?x) or (?-x) in the pattern.
See also: regexp regexpi