Re: order of NSRegularExpression matchesInString result
Re: order of NSRegularExpression matchesInString result
- Subject: Re: order of NSRegularExpression matchesInString result
- From: Douglas Davidson <email@hidden>
- Date: Wed, 15 Aug 2012 19:59:17 -0700
The matches should be returned in order.
Douglas Davidson
On Aug 15, 2012, at 8:33 AM, Koen van der Drift <email@hidden> wrote:
> I am using NSRegularExpression to search for certain words in a
> string. To interrogate the results I use something like:
>
> NSArray *matches = [regularExpression matchesInString: myString
> options:0 range: NSMakeRange(0, [myString length])];
>
> for (NSTextCheckingResult *match in matches)
> {
> NSRange matchRange = [match range];
> NSUInteger index = matchRange.location;
> etc...
> }
>
> Is there any guarantee that the matchRanges will be in order as they
> appear in the string? In other words, will the matches array be
> ordered when returned?
>
> - Koen.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden