I am using boost xpressive regex_replace . After the replace I get garbage characters at the end of the string
std::wstring wEsc(L"fxSSyrpng");
std::wstring wReplaceByText(L"tiff");
std::wstring searchText(L"fx");
wsregex regExp;
try
{
regExp = wsregex::compile( searchText );
}
catch ( regex_error &/*error*/ )
{
throw ;
}
catch (...)
{
throw ;
}
std::wstring strOut;
strOut.reserve( wEsc.length() + wReplaceByText.length() );
std::wstring::iterator it = strOut.begin();
boost::xpressive::regex_replace( it, wEsc.begin() , wEsc.end(), regExp,
wReplaceByText, regex_constants::match_not_null );