|
Boost Users : |
Subject: [Boost-users] for help, some error of boost regx
From: pirate-king (pirate-king_at_[hidden])
Date: 2010-02-23 09:53:31
Hello everyone,
When I use boost_1_41_0 of regx in vs2005, I met this runtime error:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::regex_error> >
I search a lot, but there is not valid method to solve it. Can you do me a favor to give me the way to solve it.
Thanks a lot
my code is
#include <boost/regex.hpp>
#include <iostream>
boost::regex e("(\\d{3, 4})[- ]?(\\d{4)})[- ]?(\\d{4})[- ]?(\\d{4})");
void print_captures(const std::string& regx, const std::string& text)
{
boost::regex e(regx);
boost::smatch what;
std::cout << "Expression: \"" << regx << "\"\n";
std::cout << "Text: \"" << text << "\"\n";
if (boost::regex_match(text, what, e, boost::match_extra))
{
unsigned i, j;
std::cout << "** Match found **\n Sub-Expressions: \n";
for (i = 0; i < what.size(); ++i)
std::cout << " $" << i << " = \"" << what[i] << "\"\n";
std::cout << " Captures:\n";
for (i = 0; i < what.size(); ++i)
{
std::cout << " $" << i << " = {";
for (j = 0; j < what.captures(i).size(); ++j)
{
if (j)
std::cout << ", ";
else
std::cout << " ";
std::cout << "\"" << what.captures(i)[j] << "\"";
}
std::cout << "}\n";
}
}
else
{
std::cout << "** No match found **\n";
}
}
int main(int , char* [])
{
print_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDeeeeeee");
return 0;
}
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