
18 Mar
2009
18 Mar
'09
2:33 a.m.
Hello, I'm a new boost and regex user. I tried a c++ regex sample as follows regex pattern("banan\\(an\\)*a"); string str = "bananana"; if(regex_match(str, pattern)) cout<<"---- pattern matched ----"<<endl; else cout<<"---- pattern unmatched ----"<<endl; To my surprise, the it printed out pattern unmatched. If I change str to "banan(an)a", the result is pattern matched. Feels like boost.Regex doesn't treat ( ) as subexpression. Any idea? Thanks, Qihong Wang