Valadoc | Vala | Tutorial | API-References | Markup

replace_literal


Description:

public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError

Replaces all occurrences of the pattern in regex with the replacement text.

replacement is replaced literally, to include backreferences use g_regex_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".

Parameters:

regex a GRegex structure
string the string to perform matches against. [array length=string_len]
string_len the length of string, or -1 if string is nul-terminated
start_position starting index of the string to match
replacement text to replace each match with
match_options options for the match
error location to store the error occuring, or NULL to ignore errors

Returns:

a newly allocated string containing the replacements