i have
NSString *str = @"<0x112233><0x112233><0x112233>0a";
i want this data to be saved in nsarray
nsarray : { 0x112233 0x112233 0x112233 }
only save data which is enclosed in "<>" and ignore all other.
i tried regex like this
NSString *str = @"<0x112233><0x112233><0x112233>0a";
NSError *error2;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"<(.*)>"
options:NSRegularExpressionCaseInsensitive
error:&error2];
if (error2)
{
NSLog(@"Error %@", [error2 description]);
}
NSArray *payloadRanges=[regex matchesInString:str options:0 range:NSMakeRange(0, [str length])];
NSLog(@"data %@",payloadRanges);
but i gives me this output:
data (
"<NSSimpleRegularExpressionCheckingResult: 0x1ddc5e30>{0, 30}{<NSRegularExpression: 0x1f078710> <(.*)> 0x1}"
)
NSScanneror something sane. No regexes for this.