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? May be I am using parameters in the regex string that NSRegularExpression doesn't support? Thanks a lot. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com