GLib.Regex.prototype.replace_literal

function replace_literal(string: Array(String), start_position: Number(gint), replacement: String, match_options: GLib.RegexMatchFlags): String {
    // Gjs wrapper for g_regex_replace_literal()
}
  

Replaces all occurrences of the pattern in regex with the replacement text. replacement is replaced literally, to include backreferences use GLib.Regex.prototype.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".

Since 2.14

string

the string to perform matches against

start_position

starting index of the string to match

replacement

text to replace each match with

match_options

options for the match

Returns

a newly allocated string containing the replacements