Now my app targets >iOS4 I am trying to remove dependencies on non Apple frameworks where possible.
I have this code currently
NSString *destination =@"HHH-DDDD>dddd,ffff";
NSString *searchString = destination;
NSString *regexString = @"[^a-zA-Z\?]";
NSArray *splitArray = NULL;
splitArray = [searchString componentsSeparatedByRegex:regexString];
This produces an array with string elements between all of the characters. i.e. “HHH”,”DDDD”,”dddd”,”ffff”.
There doesn’t seem to be an equivalent in the NSRegularExpression at all or am I reading the documentation wrong?
seems you’re right but you could use a category:
but I have to admit, it isn’t that performant like RegexKitLite. Heres the output for a nonsense file:
and the testing code:
I’m not sure if the difference really matters because the file has a size of ~36mb but just in case someone needs it really fast he has to use the RegexKitLite. I would like if someone could post some real performance test and/or for for default
NSRegularExpressionmethods. I want to know which one is faster =)