Boost logo

Boost Users :

From: soleani (anibal_at_[hidden])
Date: 2002-03-15 20:11:20


Hi there,

I've been using regex++ (v 3) for a while now. It's great!

I just found out that my regex core dumps my program, look:

std::string
StringUtilities::getMsqlEscapedString( const char* input )
{
    if ( input == NULL )
        return "";

    cerr << "Hello" << endl;

    std::string inputStr( input );
    cerr << "Hello111 (" << inputStr << ")" << endl;
    static const boost::regex expression1( "\\" );

    cerr << "Hello222" << endl;

    string temp = boost::regex_merge( inputStr, expression1, "\\\\" );

    cerr << "Hello33" << endl;

    static const boost::regex expression2( "'" );
    return boost::regex_merge( temp, expression2, "\\'" );
} // StringUtilities::getMsqlEscapedString

That's all I have. When I call it I see this:

Testing getMsqlEscapedString...
Hello
Hello111 (hello)
Aborted (core dumped)

So, it seems that the call to:

static const boost::regex expression1( "\\" );

makes it core dump. I went and changed that regular expression
by "\"",
just for kicks, and it works; it doesn't do what I want but it doesn't
core dump.

Anything I should do to avoid this problem?

thanks,

-Anibal


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