boost::regex problem with escaped parenthesis

Hello, While trying to match the escaped "(" I am facing problem. Following is the code snippet : std::string stdString = "abc(def)ghi"; std::string bExpression = "c\\(def\\)g"; // Creating the expression boost::regex boostRegEx ( bExpression, boost::regex::extended ); // my match function boost::smatch boostMatch; std::string::const_iterator itr_begin ( stdString.std().begin()); std::string::const_iterator itr_end ( stdString.std().end() ); bool b_match = false; // Match flags used boost::match_flag_type matchFlags = boost::regex_constants::match_default | boost::regex_constants::match_not_dot_newline | boost::regex_constants::match_single_line; // Trying to match b_match = boost::regex_search( itr_begin, itr_end, boostMatch, boostRegEx, matchFlags ); My expected result is: b_match should be "true" boostMatch should contain "c(def)g" Please help me to fix this problem. Regards, Anurag

Kumar, Anurag wrote:
Hello,
While trying to match the escaped "(" I am facing problem. Following is the code snippet :
My expected result is:
b_match should be "true"
boostMatch should contain "c(def)g"
Works as expected here for me. My guess is that since the code you posted didn't actually compile as you had written it, that something was lost when you factored it down for the email. John.
participants (2)
-
John Maddock
-
Kumar, Anurag