I've been working with RegexkitLite, and I'm wondering whether someone else who has RegexkitLite can reproduce this problem, or spot what I'm doing wrong:

NSString *originalString = @"IMUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIU";

// Using the built-in "range:" option
NSString *firstTry = [originalString stringByReplacingOccurrencesOfRegex:@"M(.*)" withString:@"M$1$1" range:NSMakeRange(1,57)];
NSLog(@"firstTry result: %@",firstTry);
        
// Using "substringWithRange:" first
NSString *cutOriginalString = [originalString substringWithRange:NSMakeRange(1, 57)]; NSString *secondTry = [cutOriginalString stringByReplacingOccurrencesOfRegex:@"M(.*)" withString:@"M$1$1"];
NSLog(@"secondTry result: %@",secondTry);

Output:

firstTry result: (null)
secondTry result: MUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIU

I contend that the results of firstTry and secondTry should be the same. What am I missing? Thanks.
_______________________________________________

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

Reply via email to