order of NSRegularExpression matchesInString result
order of NSRegularExpression matchesInString result
- Subject: order of NSRegularExpression matchesInString result
- From: Koen van der Drift <email@hidden>
- Date: Wed, 15 Aug 2012 11:33:50 -0400
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