• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
order of NSRegularExpression matchesInString result
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: order of NSRegularExpression matchesInString result
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Where do these come from...
  • Next by Date: How to sandbox an included framework
  • Previous by thread: Re: Where do these come from...
  • Next by thread: Re: order of NSRegularExpression matchesInString result
  • Index(es):
    • Date
    • Thread