Hi, I'm trying to fork out number from this expression. Obviously without any luck. I wonder if anyone could help and suggest good book about regex.

boost::regex reg("[[:blank:]]*move[[:blank:]]*\\d{1,3}[[:blank:]]*, boost::regbase::icase);

Thank you

boost::regex reg("[[:blank:]]*move[[:blank:]]*\\d{1,3}[[:blank:]]*, boost::regbase::icase);

Thank you

Ok I've figured it out. If I use parenthesis around subexpressions which I want to catch (move) and (\\d{1,3}), then by adding:

boost::match_results<std::string::const_iterator> m_r;

and finally:

(boost::regex_match("some_string", m_r, reg)

then I have :

cerr << "m_r[0]" << m_r[0] << endl;
cerr << "m_r[1]" << m_r[1] << endl;

I mark this as a resolved thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.