GLib.Regex.check_replacement

function check_replacement(replacement: String): [ok: Boolean, has_references: Boolean] {
    // Gjs wrapper for g_regex_check_replacement()
}
  

Checks whether replacement is a valid replacement string (see GLib.Regex.prototype.replace), i.e. that all escape sequences in it are valid.

If has_references is not null then replacement is checked for pattern references. For instance, replacement text 'foo\n' does not contain references and may be evaluated without information about actual match, but '\0\1' (whole match followed by first subpattern) requires valid GLib.MatchInfo object.

Since 2.14

replacement

the replacement string

ok

whether replacement is a valid replacement string

has_references

location to store information about references in replacement or null