I have a QString like
QString qReplaceByText("**\\g<char>**");
If I try to convert it to a wstring its replacing \ with \\
std::wstring wReplaceByText = qReplaceByText.toStdWString()
;
qReplaceByText becomes
**\\\\g<char>**
How can I avoid this ?
This is my code snippet
std::wstring searchText(L"(?P<char>.)(?P=char)");;
wsregex regExp;
std::wstring strOut;
try
{
regExp = wsregex::compile( searchText, boost::xpressive::icase );
std::wstring wsObjectName = L"tweet" ;
std::wstring wReplaceByText = qReplaceByText.toStdWString();
strOut.resize( wsObjectName.length() + wReplaceByText.length() );
std::wstring::iterator itOut = strOut.begin();
boost::xpressive::regex_replace(itOut, wsObjectName.begin() , wsObjectName.end(), regExp, wReplaceByText, regex_constants::format_perl );
}