[Regex] A bug with #define BOOST_REGEX_MATCH_EXTRA in using char type

Dear all: if you #define BOOST_REGEX_MATCH_EXTRA, using char type will crash, but using string is well. Is that a bug? My environment is Windows XP, C++ Builder 2007. I show the example below: #define BOOST_REGEX_MATCH_EXTRA #include <boost/regex.hpp> #include <iostream> using namespace std; int main() { boost::regex reg("(.*)(\\d{2})"); boost::cmatch m; const char* text = "Note that I'm 31 years old, not 32."; if(boost::regex_search(text,m, reg)) { if (m[1].matched) std::cout << "(.*) matched: " << m[1].str() << '\n'; if (m[2].matched) std::cout << "Found the age: " << m[2] << '\n'; } } It will crash..... If don't #define BOOST_REGEX_MATCH_EXTRA, it works well. And the string type works both well. Maybe this is a bug? thank you for reading.

sevenjay wrote:
Dear all: if you #define BOOST_REGEX_MATCH_EXTRA, using char type will crash, but using string is well. Is that a bug? My environment is Windows XP, C++ Builder 2007. I show the example below:
Did you build the regex library with BOOST_REGEX_MATCH_EXTRA defined? The only way to make this work correctly is to add that define to boost/regex/user.hpp and then rebuild the regex library as well as your application. HTH, John.

2008/4/17, John Maddock <john@johnmaddock.co.uk>:
sevenjay wrote:
Dear all: if you #define BOOST_REGEX_MATCH_EXTRA, using char type will crash, but using string is well. Is that a bug? My environment is Windows XP, C++ Builder 2007. I show the example below:
Did you build the regex library with BOOST_REGEX_MATCH_EXTRA defined? The only way to make this work correctly is to add that define to boost/regex/user.hpp and then rebuild the regex library as well as your application.
HTH, John.
thank you for reply. I resolve the problem. when you defined BOOST_REGEX_MATCH_EXTRA, then you must rebuild the regex library. I did do define that before, but didn't rebuild the regex library. I only rebuild my project so it crash when I used char type. So I think there is no flexibility when we turn of/off BOOST_REGEX_MATCH_EXTRA. And both must rebuild the regex library. thanks for your reading
participants (2)
-
John Maddock
-
sevenjay