boost::regex re("(abc)(.*?)");
boost::smatch m;
std::string str = "abcdlogin";
boost::regex_search(str, m, re);
I found m[1].first is “abcdlogin”, m[1].second is “dlogin”.
But I think is m[1].first should be “abc”?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As noted in the documentation:
Note how they are iterators into the matching sub-expression.
In your example, if you want a string with
"abc", you can construct a string like this:std::string s(m[1].first, m[1].second);.