• 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
Re: order of NSRegularExpression matchesInString result
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >order of NSRegularExpression matchesInString result (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Perplexity with X3D and XML
  • Next by Date: Displaying a sheet immediately after a window is opened
  • Previous by thread: order of NSRegularExpression matchesInString result
  • Next by thread: How to sandbox an included framework
  • Index(es):
    • Date
    • Thread