Regex.replaceLiteral

Replaces all occurrences of the pattern in @regex with the replacement text. @replacement is replaced literally, to include backreferences use g_regex_replace().

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".

class Regex
string
replaceLiteral

Parameters

str string

the string to perform matches against

startPosition int

starting index of the string to match, in bytes

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

Since

2.14