|
Boost : |
From: Preston A. Elder (prez_at_[hidden])
Date: 2005-02-02 22:13:36
Hum,
Consider the following application (running on Linux with GCC):
=== BEGIN CODE
#include <boost/regex.hpp>
#include <iostream>
#include <exception>
#include <typeinfo>
int main()
{
try
{
std::string rx_string =
"^([[:alpha:]][-[:alnum:]]*[[:space:]]*)+$";
boost::regex rx(rx_string, boost::regex_constants::char_classes |
boost::regex_constants::intervals);
std::string test = "GlobalMSG HelpServ DevNull";
if (boost::regex_match(test, rx))
std::cout << "Matched." << std::endl;
else
std::cout << "Not Matched." << std::endl;
}
catch (const std::exception &e)
{
std::cout << "Exception " << typeid(e).name() << ": " << e.what()
<< std::endl;
}
return 0;
}
=== END CODE
The result of running this is:
Exception N5boost14bad_expressionE: Memory exhausted
My question is, why? The regex is simple enough, and the source string is
quite short. Please note, the same regex with the test string of:
"OperServ Magick-1"
runs and completes successfully without a problem.
Any ideas on how to fix this?
-- PreZ :) Founder. The Neuromancy Society (http://www.neuromancy.net)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk