Regex.replace

Replaces all occurrences of the pattern in regex with the replacement text. Backreferences of the form '\number' or '\g<number>' in the replacement text are interpolated by the number-th captured subexpression of the match, '\g<name>' refers to the captured subexpression with the given name. '\0' refers to the complete match, but '\0' followed by a number is the octal representation of a character. To include a literal '\' in the replacement, write '\\'. Since 2.14

class Regex
string
replace

Parameters

string string

the string to perform matches against. [array length=string_len]

startPosition int

starting index of the string to match

replacement string

text to replace each match with

matchOptions GRegexMatchFlags

options for the match

Return Value

Type: string

a newly allocated string containing the replacements

Throws

GException on failure.

Meta