Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-04-25 11:47:44


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_results<std::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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net