|
Boost : |
From: sevenjay (sevenjay.blog_at_[hidden])
Date: 2008-04-17 00:13:17
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk