Re: NSRegularExpression only finds a single occurrence of my match
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