regex expression core dumps with \\
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
On 3/15/02 5:11 PM, "soleani"
So, it seems that the call to:
static const boost::regex expression1( "\\" );
makes it core dump.
Not sure why you got a core dump, but I do know what the problem is. The
regular expression code is throwing an exception because your expression is
bad. Try this program:
#include <iostream>
#include
participants (2)
-
Darin Adler
-
soleani