
I got the string (char*s), which is too big (>10M), from an external library, it's too slow to convert the raw string to std::string before it is handled by replace_all_regex
Here's your fundamental problem: regex does not do in-place search and replace. Further: * Any attempt to do so on a fixed size buffer runs the risk of buffer over-run errors, the *best* that you might hope for is that the application only crashes infrequently! * In-place replace is often slower than copying: all that shuffling of characters around in the buffer as the size of each matched section is adjusted is a time-killer. In the worst case it's O(N^2), where as copying is amortized O(N). You can clearly use your C-string as the source for the regex search and replace, but the destination must be somewhere else. Could be a string, could be a vector<char>, could be a stream, could be.... whatever. John.