• 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: NSRegularExpression only finds a single occurrence of my match
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSRegularExpression only finds a single occurrence of my match


  • Subject: Re: NSRegularExpression only finds a single occurrence of my match
  • From: Keary Suska <email@hidden>
  • Date: Sun, 17 Oct 2010 10:30:56 -0600

On Oct 17, 2010, at 12:38 AM, Devraj Mukherjee wrote:

> Hi all,
>
> I am trying to use Regular Expressions to match uppercase letters in
> strings like "numberOfNames" which I want to replace with
> number_of_names. Code sample
>
>
> 	NSError *error = NULL;
> 	NSRegularExpression *regex = [NSRegularExpression
> regularExpressionWithPattern:@"[a-z]+([A-Z][a-z]+)*"
> 																		   options:NSRegularExpressionAllowCommentsAndWhitespace
> 																			 error:&error];
>
>
> 	NSMutableString *aStr = [NSMutableString
> stringWithString:@"numberOfElementsAtHome"];
> 	NSLog(@"%i", [regex numberOfMatchesInString:aStr
> 								options:NSRegularExpressionCaseInsensitive
> 								  range:NSMakeRange(0, [aStr length])]);
>
> In all cases my regular expressions matches one occurrence.
>
> Can anyone see what I might be getting wrong?

options: *NSRegularExpressionCaseInsensitive*

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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: 
 >NSRegularExpression only finds a single occurrence of my match (From: Devraj Mukherjee <email@hidden>)

  • Prev by Date: Re: Store NSPredicate in Core Data
  • Next by Date: Re: Store NSPredicate in Core Data
  • Previous by thread: Re: NSRegularExpression only finds a single occurrence of my match
  • Next by thread: Store NSPredicate in Core Data
  • Index(es):
    • Date
    • Thread