[boost 1.53.0]
Hello,
I'd like to find in a stream of text either "abcd" or "ab". The text is not
bounded in size, so I think I should use partial_match.
However I present it the following text: "hello abcd, how are
you?"
it reports to find "ab" and does not wait for the second block to be
appended.
#include "boost/regex.hpp"
int main(int argc, char* argv[])
{
boost::regex re ("abcd|ab");
std::string str ("hello abc");
boost::match_resultsstd::string::const_iterator results;
bool found = boost::regex_search (str.cbegin(), str.cend(), results, re,
boost::regex_constants::match_partial);
if (!found || results[0].matched)
printf("problem...\n");
return 0;
}
Am I doing something wrong?
I see in the specification that "Specifies that if no match can be found,
then ....", isn't this specification flowed?
should not it be "if the regular expression engine needs to check past the
end of the block of text, and the start matches partially, ...." ?
I hope I am wrong and there are good flags to pass....
Regards
Armel