6642
6642
/* Repeatedly replace the string with the matched regex */
6643
6643
string subject(in_string);
6644
6644
size_t replace_length= strlen(replace);
6646
6645
size_t current_position= 0;
6647
while(0 >= (rc= pcre_exec(re, NULL, subject.c_str() + current_position, subject.length() - current_position,
6651
rc= pcre_exec(re, NULL, subject.c_str(), subject.length(),
6652
current_position, 0, ovector, 3);
6658
6650
current_position= static_cast<size_t>(ovector[0]);
6659
6651
replace_length= static_cast<size_t>(ovector[1] - ovector[0]);
6660
subject.replace(current_position, replace_length, replace, length_of_replacement);
6652
subject.replace(current_position, replace_length, replace, replace_length);
6664
6655
char *new_buf = (char *) malloc(subject.length() + 1);