NSPredicate for Regular Search
ios, nspredicate
Solution
Thanks guys for your responses Here's what I come up with
NSString *matchString = [NSString stringWithFormat: @".*\\b%@.*",searchText];
NSString *predicateString = @"keyword MATCHES[c] %@";
NSPredicate *predicate =[NSPredicate predicateWithFormat: predicateString, matchString];
Problem
I am using NSPredicate for the performing Search as it does on iPhone when we search for any app. I have say for example 4 keywords - Deccan - New Delhi - Ahmedabad - Salaam Delhi I have tried creating a predicate with `NSPredicate *predicate = [NSPredicate predicateWithFormat:@"keyword BEGINSWITH[c] 'd'"` It gives me Deccan as output. But the problem is I want each word starting with d So from the above example I need output as Deccan, New Delhi, Salaam Delhi but NOT Ahmedabad Stucked in this issue from hours. tried contains, matches but my bad luck.. Any help towards right path will really be appreciated..