Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Named Group support for regular expressions in TR1?

Reply
Thread Tools

Named Group support for regular expressions in TR1?

 
 
DomoChan@gmail.com
Guest
Posts: n/a
 
      08-10-2008
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
 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      08-11-2008
On Aug 10, 5:21*pm, DomoC...@gmail.com 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-lit...t.html#faq-5.8

Cheers! --M
 
Reply With Quote
 
 
 
 
DomoChan@gmail.com
Guest
Posts: n/a
 
      08-11-2008
On Aug 11, 8:59*am, mlimber <mlim...@gmail.com> wrote:
> On Aug 10, 5:21*pm, DomoC...@gmail.com 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-lit...t.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/d...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;
}
 
Reply With Quote
 
mlimber
Guest
Posts: n/a
 
      08-12-2008
On Aug 11, 7:04*pm, DomoC...@gmail.com wrote:
> On Aug 11, 8:59*am, mlimber <mlim...@gmail.com> wrote:
>
> > On Aug 10, 5:21*pm, DomoC...@gmail.com 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-lit...t.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/d...d=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/de...lib_regex.html

Am I missing something?

Cheers! --M
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
European Language Support - Regular Expressions pramodx Javascript 5 12-18-2008 01:57 AM
Group names in regular expressions donn@cmscms.com Ruby 1 11-15-2006 07:06 PM
Capturing repeating group matches in regular expressions James Collier Python 4 08-12-2004 10:57 AM
Re: Capturing repeating group matches in regular expressions Fredrik Lundh Python 0 08-11-2004 01:45 PM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57