replace


Description:

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

Example: Regex, replace:

public int main (string[] args){
try {
string quote = "This is a simple sample.";
Regex regex = new Regex ("s[ai]mple");

// Output: ``Result: This is a XXX XXX.``
string result = regex.replace (quote, quote.length, 0, "XXX");
print ("Result: %s\n", result);
} catch (RegexError e) {
print ("Error: %s\n", e.message);
}
return 0;
}

valac --pkg glib-2.0 GLib.Regex.replace.vala