Given a string attribute like this "Red Globe 21# Bag SO2 SF White 5L Styro A"
I need to match By "Red Globe 21#" (or|and) "Bag" (or|and) "SO2" (or|and) "SF White".
Following the sample posted by dasblinkenlight NSPredicate Exact Match with String
I was trying to figure out the right combination for this RegEx
NSString *str = @"Globe";
NSMutableString *arg = [NSMutableString string];
[arg appendString:@"\\s*\\b"];
[arg appendString:str];
[arg appendString:@"\\b\\s*\\w*"];
NSPredicate *p = [NSPredicate predicateWithFormat:@"SELF matches[c] %@", arg];
NSArray *a = [NSArray arrayWithObjects:@"Red Globe 21# Bag SO2 SF White 5L Styro A ", @"test", @"Test", @"TEST", nil];
NSArray *b = [a filteredArrayUsingPredicate:p];
NSLog(@"Result ;%@",b);`
But It does no work for me, I will appreciate your help.