app crash on simple boost::regex

E

expert.cpp

Hi, I'm trying to use this regex code:

const boost::regex::flag_type f = boost::regex_constants::normal |
boost::regbase::icase;
const boost::regex fooo(
".*"
"unit"
"[ \t]+"
"[A-Z]|[a-z](?:[A-Z]|[a-z]|[0-9]|_)*"
"[ \t\n]+?"
"\{"
"[ \t\n]+"
"(.*)"
"\}"
"([^}]*)"
, f);

const std::string sTemp(szFileBuf); // ÉÓÈÏÄÎÙÊ ÔÅËÓÔ × szFileBuf
boost::match_results<std::string::const_iterator> what;
bool bRet = boost::regex_match(sTemp, what, fooo);


to get the body of block "unit" (just a list of function definitions)
and the last part: a call to one of those functions, In this case it
is MainFunction(), from this file


// comments
unit XXX
{
//
#include "header.h"

// arbitrary number of C/C++ functions
a_type Function1([optional args])
{
// C/C++ code
}

a_type FunctionN([optional args])
{
// C/C++ code
}

type MainFunction([optional args])
{
// C/C++ code
}
}

MainFunction();


It works with first 4 parts of regular expression. But it crashes when
I add other parts.
Can somebody help me correct this regex?

I'm doint that on Vista 64-bit, with Visual Studio 2005, boost::regex
linked statically if that matters.

Thanks,
Sava
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top