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

class SourceSearchContext
bool
replace

Parameters

matchStart TextIter

the start of the match to replace.

matchEnd TextIter

the end of the match to replace.

replace string

the replacement text.

replaceLength int

the length of replace in bytes, or -1.

Return Value

Type: bool

whether the match has been replaced.

Throws

GException on failure.

Meta