• 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: rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)


  • Subject: Re: rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 12 Jun 2015 06:13:08 -0700

By default those match beginning and end of string. If you use NSRegularExpression, there's an AnchorsMatchLines option to control this behavior.

Douglas Davidson

> On Jun 12, 2015, at 3:41 AM, Antonio Nunes <email@hidden> wrote:
>
> Hi,
>
> I a trying to find a line within a string. When I write:
>
> let match = crashReport.rangeOfString("\nIdentifier:.*\n", options: .RegularExpressionSearch)
>
> …I get a match.
>
> However, when I write
>
> let match = crashReport.rangeOfString(“^Identifier:.*$", options: .RegularExpressionSearch)
>
> …which would seem more to the point, no match is returned. Shouldn’t this work, if the above works?
>
> Am I overlooking something obvious?
>
> -António
> _______________________________________________
>
> 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: 
 >rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift) (From: Antonio Nunes <email@hidden>)

  • Prev by Date: Re: Going back to non-ARC
  • Next by Date: Re: iOS version check
  • Previous by thread: rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)
  • Next by thread: Menu Bar App: [NSStatusItem popUpStatusItem] : Menu shows popupmenu too high
  • Index(es):
    • Date
    • Thread