std::string Text = "source";
std::string ToReplace = "so";
std::string ReplaceWith = "11";
Text.replace(Text.find(ToReplace),ToReplace.length(),ReplaceWith);
#include <regex>
#include <string>
#include <iostream>
using namespace std;
int main()
{
string t = "asd asd asd";
t = regex_replace(t, regex("asd"), "sdf");
cout << t;
return 0;
}