25 Apr
2007
25 Apr
'07
3:47 p.m.
Kalin Nakov wrote:
Hi,
I experience big troubles with regex matching. The code below should obviously match 'abc', but does not, because it tries to match the whole string. If r='abcdefg', then match is successfull, but if it is only 'abc' and input is 'abcdef', the match always fails as described below.
boost::match_resultsstd::string::const_iterator m; std::string inp = "abcdefg"; boost::regex r = "abc"; if (!boost::regex_match(inp, m, r, boost::match_default)) // always fails, don't know why
How can I successfully match 'abc' agains input 'abcdefg'?
Use regex_search. John.