Named Group support for regular expressions in TR1?

Discussion in 'C++' started by DomoChan@gmail.com, Aug 10, 2008.

  1. Guest

    When I attempt to name a group in a regular expression under TR1, the
    library throws a non descriptive error "regular expression error".
    The numbered reference group works, as in /1 to reference the first
    group. However, any attempt to use (?<myGroup>expression) fails?

    Does anyone have any insight into this?

    Thanks!
    -Velik
     
    , Aug 10, 2008
    #1
    1. Advertising

  2. mlimber Guest

    On Aug 10, 5:21 pm, wrote:
    > When I attempt to name a group in a regular expression under TR1, the
    > library throws a non descriptive error "regular expression error".
    > The numbered reference group works, as in /1 to reference the first
    > group.  However, any attempt to use (?<myGroup>expression) fails?
    >
    > Does anyone have any insight into this?


    How about minimal but complete code (and input) to reproduce the
    problem? Compare this FAQ on posting non-working code:

    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.8

    Cheers! --M
     
    mlimber, Aug 11, 2008
    #2
    1. Advertising

  3. Guest

    On Aug 11, 8:59 am, mlimber <> wrote:
    > On Aug 10, 5:21 pm, wrote:
    >
    > > When I attempt to name a group in a regular expression under TR1, the
    > > library throws a non descriptive error "regular expression error".
    > > The numbered reference group works, as in /1 to reference the first
    > > group.  However, any attempt to use (?<myGroup>expression) fails?

    >
    > > Does anyone have any insight into this?

    >
    > How about minimal but complete code (and input) to reproduce the
    > problem? Compare this FAQ on posting non-working code:
    >
    > http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.8
    >
    > Cheers! --M


    Certainly...

    // Compiler Information
    Version 9.0.21022.8 RTM
    Microsoft .NET Framework
    Version 3.5
    Installed Edition: Enterprise
    Microsoft Visual C++ 2008 91899-153-0000007-60443
    // Operating System
    Windows Vista

    #include <string>
    using std::string;

    // This example should be compiled with visual studio 2008, with the
    TR1 update
    // TR1 Update Link :
    http://www.microsoft.com/downloads/...6B-8DAB-445F-A7B4-448B326C48E7&displaylang=en
    #include <regex>
    using namespace std::tr1;

    int main(int argc, char* argv[])
    {
    try
    {
    // this works
    regex pattern1( "<[\\?](.+)[\\?]>?" );
    // this fails
    regex pattern2( "<[\\?](?'groupName'.+)[\\?]>?" );
    // so does this
    regex pattern3( "<[\\?](?<groupName>.+)[\\?]>?" );
    }
    catch (std::exception& exc)
    {
    // shows up as "regular expression error", "unknown (?'groupName')
    would have been nice :/ oh well
    string dbg = exc.what();
    }

    return 0;
    }
     
    , Aug 12, 2008
    #3
  4. mlimber Guest

    On Aug 11, 7:04 pm, wrote:
    > On Aug 11, 8:59 am, mlimber <> wrote:
    >
    > > On Aug 10, 5:21 pm, wrote:

    >
    > > > When I attempt to name a group in a regular expression under TR1, the
    > > > library throws a non descriptive error "regular expression error".
    > > > The numbered reference group works, as in /1 to reference the first
    > > > group.  However, any attempt to use (?<myGroup>expression) fails?

    >
    > > > Does anyone have any insight into this?

    >
    > > How about minimal but complete code (and input) to reproduce the
    > > problem? Compare this FAQ on posting non-working code:

    >
    > >http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.8

    >
    > > Cheers! --M

    >
    > Certainly...
    >
    > // Compiler Information
    > Version 9.0.21022.8 RTM
    > Microsoft .NET Framework
    > Version 3.5
    > Installed Edition: Enterprise
    > Microsoft Visual C++ 2008   91899-153-0000007-60443
    > // Operating System
    > Windows Vista
    >
    > #include <string>
    > using std::string;
    >
    > // This example should be compiled with visual studio 2008, with the
    > TR1 update
    > // TR1 Update Link :http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DA...
    > #include <regex>
    > using namespace std::tr1;
    >
    > int main(int argc, char* argv[])
    > {
    >         try
    >         {
    >                 // this works
    >                 regex pattern1( "<[\\?](.+)[\\?]>?" );
    >                 // this fails
    >                 regex pattern2( "<[\\?](?'groupName'.+)[\\?]>?" );
    >                 // so does this
    >                 regex pattern3( "<[\\?](?<groupName>.+)[\\?]>?" );
    >         }
    >         catch (std::exception& exc)
    >         {
    >                 // shows up as "regular expression error", "unknown (?'groupName')
    > would have been nice :/ oh well
    >                 string dbg = exc.what();
    >         }
    >
    >         return 0;
    >
    > }


    Looking at the Dinkumware documentation, I don't see support for named
    groups in the RE grammar.

    http://www.dinkumware.com/manuals/default.aspx?manual=compleat&page=lib_regex.html

    Am I missing something?

    Cheers! --M
     
    mlimber, Aug 12, 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. Jay Douglas
    Replies:
    0
    Views:
    610
    Jay Douglas
    Aug 15, 2003
  2. Scott Meyers

    gcc TR1 support under Windows 2000?

    Scott Meyers, Nov 1, 2006, in forum: C++
    Replies:
    4
    Views:
    603
    Scott Meyers
    Nov 3, 2006
  3. Emmanuel Deloget
    Replies:
    3
    Views:
    404
    Chris Thomasson
    Mar 3, 2007
  4. Mohan L
    Replies:
    3
    Views:
    86
  5. Noman Shapiro
    Replies:
    0
    Views:
    235
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page