Hi All,

RegexKitLite looks promising. It claims to only require you to add the .h and .m file to your project and link to the libicucore.dylib library.

I managed to incorporate RegexKitLite fairly easily once I found in the documentation the steps to link to the libicucore.dylib library.

Thanks for all your comments about ICU vs PCRE. I've thrown a couple of fairly involved regexes at it that I've previously used in Perl (therefore PCRE) and haven't had to make any adjustments at all.

I've wrapped it in a test Cocoa app that shows capture in an outline view, with each group showing as a child item of its capture. It's working very well so far. The essence of my use of RegexKitLite here is:

- (IBAction)update:(id)sender
{
        NSString * regexString = [regexField string];
        NSString * inputString = [inputField string];
                
[outputArray release]; // already defined as an instance variable in the .h file
        NSError * myError = nil;
        NSRange myRange = NSMakeRange(0, [inputString length]);
outputArray = [inputString arrayOfCaptureComponentsMatchedByRegex:regexString options:RKLNoOptions range:myRange error:&myError];
        [outputArray retain];
        [outputOutline reloadData];
}
@end

I'm new to Cocoa and Objective-C. So please tell me gently of any glaring errors above

Now to use it in my real project, I need to port over my routines that parsed SQL statements. I have been doing this by:

1. Using regex to replace quoted items (eg bounded by " or ' or a comment bounded by /* */ or -- \n) with placeholders.

2. Using regex to parse the SQL (now containing placeholders) into desired SQL components

3. Replacing placeholders with original text.

Before I go ahead and port this same method across, is there any built in functionality in Cocoa that will facilitate this (or part of it) directly?

Thanks,
Tom
BareFeet

_______________________________________________

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