replace


Description:

public bool replace (TextIter match_start, TextIter match_end, string replace, int replace_length) throws Error

Replaces a search match by another text.

If match_start and match_end doesn't correspond to a search match, false is returned.

match_start and match_end iters are revalidated to point to the replacement text boundaries.

For a regular expression replacement, you can check if replace is valid by calling [func@GLib.Regex.check_replacement]. The replace text can contain backreferences.

Parameters:

this

a SearchContext.

match_start

the start of the match to replace.

match_end

the end of the match to replace.

replace

the replacement text.

replace_length

the length of replace in bytes, or -1.

Returns:

whether the match has been replaced.