I am tring to use back-reference in boost version 1.44 but this don’t work for me.
this is my code:
boost::regex_constants::syntax_option_type flags = boost::regex::extended;
std::string regx="(aaa)bb\1";
std::cout << "Expression: \"" << regx << "\"\n";
std::string str ="aaabbaaa";
boost::regex e(regx,flags);
if(boost::regex_match(text, what, e))//, boost::match_extra))
{
std::cout<<"found";
} else
{
std::cout<<"not found";
}
and this is my ouput:
Expression: "(aaa)bbb☺"
** not found **
Press any key to continue . . .
what I am missing?
when I try std::string regx="(aaa)bb\\1" program crashed in boost::regex e(regx,flags);
mybe I miss some flag?
I fix this problem by chaning this row
to
and ofcourse use
\\and this work for me.
thanks