Replaces all occurrences of the pattern in this 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 `\\\\`.
There are also escapes that changes the case of the following text:
If you do not need to use backreferences use replace_literal.
The replacement string must be UTF-8 encoded even if g_regex_raw was passed to
Regex. If you want to use not UTF-8 encoded strings you can use
replace_literal.
Setting start_position differs from just passing over a shortened string and setting
g_regex_match_notbol in the case of a pattern that begins with any kind of lookbehind assertion, such as "\b".
| this |
a Regex structure |
| string_len |
the length of |
| start_position |
starting index of the string to match, in bytes |
| replacement |
text to replace each match with |
| match_options |
options for the match |
| string |
the string to perform matches against |
|
a newly allocated string containing the replacements |