I am using boost::xpressive::regex_search to perform search and replace of string by either text or regular expression . Following is my code which crashes in the regex_replace function
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
using namespace boost::xpressive;
#include <iostream>
#include <algorithm>
int _tmain(int argc, _TCHAR* argv[])
{
std::wstring wsObjectName(L"tweet");
std::wstring pStr = wsObjectName;
std::wstring wEsc = pStr;
std::wstring wReplaceByText(L"\\*\\*\\g<char>\\*\\*");
std::wstring searchText(L"tweet");
wsregex regExp;
try
{
regExp = wsregex::compile( searchText );
}
catch ( regex_error &/*error*/ )
{
throw ;
}
catch (...)
{
throw ;
}
std::wstring wReplaceByText1 ;
std::wstring ws = boost::xpressive::regex_replace( wEsc, regExp, wReplaceByText, regex_constants::format_perl | regex_constants::match_not_null );
wcout<<ws;
return 0;
}