SearchContext.replace

bool replace(gtk.text_iter.TextIter matchStart, gtk.text_iter.TextIter matchEnd, string replace)

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 [glib.regex.Regex.checkReplacement]. The replace text can contain backreferences; read the [glib.regex.Regex.replace] documentation for more details.

Parameters

matchStartthe start of the match to replace.
matchEndthe end of the match to replace.
replacethe replacement text.

Returns

whether the match has been replaced.

Throws

[ErrorWrap]