Re: OgreKit, onigurama, and named groups
Re: OgreKit, onigurama, and named groups
- Subject: Re: OgreKit, onigurama, and named groups
- From: Satoshi Matsumoto <email@hidden>
- Date: Mon, 03 Jan 2005 16:36:57 +0900
Hi,
Sorry for my slow response.
on 04.12.29 2:52 PM, Roarke Lynch at email@hidden wrote:
> Has anyone had any success getting named groups from OgreKit? I have
> looked over the syntax documation for onigurama, and it plainly says
> that named groups are included in the syntax but i simple cannot get
> them to work. I cannot read the docs for OgreKit as they are in
> Japanese but I understand it to be mainly a Obj-C wrapper for the C
> onigurama. What really confuses me is that it can recognize the named
> groups within the expression but doesn't seem to apply this name to
> matches.
> For instance if I do the following:
>
> OGRegularExpression *regex = [OGRegularExpression
> regularExpressionWithString:@"(?<document>.+)"];
> NSLog(@"has %d named groups: %@", [regex numberOfNames], [regex
> names]);
>
> I get:
> "has 1 named groups: (null)"
I have got an answer from Isao Sonobe, the author of OgreKit.
In order to use named groups, you need to assign OgreCaptureGroupOption as
below.
OGRegularExpression *regex = [OGRegularExpression
regularExpressionWithString:@"(?<document>.+)"
options:OgreCaptureGroupOption];
This spec is derived from Oniguruma.
Mr.Sonobe also thinks this spec is not intuitive and he is now consulting
with Mr.Kosako, the author of Oniguruma to remove the assignment of
OgreCaptureGroupOption.
Satoshi Matsumoto,
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden