Boost logo

Boost :

From: Preston A. Elder (prez_at_[hidden])
Date: 2005-02-02 22:13:36


Consider the following application (running on Linux with GCC):

#include <boost/regex.hpp>
#include <iostream>
#include <exception>
#include <typeinfo>

int main()
        std::string rx_string =
        boost::regex rx(rx_string, boost::regex_constants::char_classes |
        std::string test = "GlobalMSG HelpServ DevNull";

        if (boost::regex_match(test, rx))
            std::cout << "Matched." << std::endl;
            std::cout << "Not Matched." << std::endl;
    catch (const std::exception &e)
        std::cout << "Exception " << typeid(e).name() << ": " << e.what()
             << std::endl;

    return 0;

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 (

Boost list run by bdawes at, gregod at, cpdaniel at, john at