Reputation: 2057
I have a string to be searched
QString sObjectName = "looolok"
The regex_search for ".?o" results in 3 matched texts which I push to a vector matchedText
"lo" "oo" "lo"
Now I my replace text is "o" So I would expect the str to be changed to
oook
I am using boost xpressive regex_replace for this operation . This is my code
std::vector<QString>::iterator it = matchedText.begin();
wsregex regExp;
std::string strOut;
std::string::iterator itStr = strOut.begin(); ;
for( ; it != matchedText.end(); ++it )
{
regExp = wsregex::compile( (*it).toStdWString() );
boost::xpressive::regex_replace( itStr, sObjectName.begin(), sObjectName.end(), regExp, qReplaceBy.toStdString(), regex_constants::format_perl );
}
However the strOut contains ooook. What am I missing ?
Upvotes: 0
Views: 128