app crash on simple boost::regex

Discussion in 'C++' started by expert.cpp@gmail.com, Aug 15, 2008.

  1. Guest

    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
    , Aug 15, 2008
    #1
    1. Advertising

  2. brad Guest

    brad, Aug 15, 2008
    #2
    1. Advertising

  3. mlimber Guest

    On Aug 15, 9:11 am, brad <> wrote:
    > Try the boost mailing list. They may help you.


    No, this is a legitimate question here since Boost.Regex became TR1's
    Regex.

    Cheers! --M
    mlimber, Aug 15, 2008
    #3
  4. peter koch Guest

    On 15 Aug., 17:37, mlimber <> wrote:
    > On Aug 15, 9:11 am, brad <> wrote:
    >
    > > Try the boost mailing list. They may help you.

    >
    > No, this is a legitimate question here since Boost.Regex became TR1's
    > Regex.


    Well... that does not invalidate Brads very good suggestion!

    /Peter
    peter koch, Aug 15, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Latter
    Replies:
    2
    Views:
    2,900
    Julie
    May 17, 2004
  2. Replies:
    5
    Views:
    1,091
  3. Alan Patterson

    simple failure of boost::regex

    Alan Patterson, Mar 13, 2007, in forum: C++
    Replies:
    1
    Views:
    288
    Pierre Senellart
    Mar 13, 2007
  4. Barry
    Replies:
    1
    Views:
    466
    Eric Niebler
    Jul 11, 2007
  5. Chris Kimmel

    what in this value is making an app.config crash an app?

    Chris Kimmel, Jun 16, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    138
    Chris Kimmel
    Jun 16, 2004
Loading...

Share This Page