
When changing the "search for word characters" from greedy to non-greedy, it starts to match whitespace characters. Attached is an example program. If you remove the '?' to make the search greedy, then it (correctly) doesn't match. I am using boost 1.31.0, on WinXP using VC7.1. I have confirmed that this does not occur on my Linux machine. Also attached is my Jamfile to make sure I didn't just compile it wrong. It occurs in both debug and release mode. John =:-> project-root ; exe test : test.cpp #unit_test_example1.cpp : <sysinclude>$(BOOST_ROOT) <stlport-iostream>on <library-path>$(BOOST_ROOT)/../../lib <vc7.1><debug><find-library>libboost_regex-vc71-mt-gd <vc7.1><release><find-library>libboost_regex-vc71-mt <gcc><debug><find-library>boost_regex-gcc-mt-d <gcc><release><find-library>boost_regex-gcc-mt <threading>multi ; # vim: ts=4 #include <boost/regex.hpp> #include <iostream> boost::regex re("(\\w*?)"); void doesMatch(std::string s) { boost::smatch m; std::cout << "String: \"" << s << "\"" << std::endl; if(boost::regex_match(s, m, re)) { std::cout << "Matched: "; std::cout << "\"" << std::string(m[1]) << "\"" << std::endl; } else { std::cout << "Didn't match" << std::endl; } std::cout << std::endl; } int main(int argc, char **argv) { if(argc > 1) for(int i = 1; i < argc; ++i) doesMatch(argv[i]); else { char *arg[] = {"", "should", "should\tnot", "shou_ld", "should not" ," doesn't " }; main(sizeof(arg)/sizeof(char*), arg); } }