title: Filter NSArray with NSPredicate inexact/similar match?
body: <p>I have an NSArray of 5 NSArrays that each contain NSDictionaries. The dictionaries contain only strings. I'm trying to use NSPredicate to filter out particular dictionaries, however it only seems to work with an exact match. I would like for it to ignore any punctuation such as <code>:</code> or <code>-</code>. Here's what I have currently.</p>
  
  <pre><code>NSString *seriesTitle = @" Fullmetal Alchemist Brotherhood - ";
  NSPredicate *titlePredicate = [NSPredicate predicateWithFormat:
                                     @"series_title CONTAINS[cd]%@", seriesTitle];
  NSArray *filtered = [arraytoEvaluate filteredArrayUsingPredicate:titlePredicate]
  </code></pre>
  
  <p>Within "arraytoEvaluate" is an NSDictionary containing this key-value pair <code>@"series_title" : @"Fullmetal Alchemist: Brotherhood"</code>. That's the one I want it to match to. My predicate does not pick this up even though I'm requesting a [cd] search, which I believe ignores punctuation/whitespace, correct? </p>
  
  <p>Using <code>series_title LIKE[cd]%@</code>gives me this crash:</p>
  
  <p><code>'NSInvalidArgumentException', reason: 'Can't do regex matching on object</code></p>
  
  <p>Using <code>BEGINSWITH</code> instead gives me this:
  <code>'NSInvalidArgumentException', reason: 'Can't do a substring operation with something that isn't a string</code></p>
  
  <p>If I pass in the string exactly, it will pick it up and give me the the Array that contains the dictionary that contains a match, but only if the search term is an exactly match. </p>
  
  <p>Also, it will give me all of them, not an NSArray containing the single NSDictionary that contains a match. I'm not sure what to do about that. I understand that <code>filteredArrayUsingPredicate</code> is supposed to return an Array, but I will then need to iterate through that Array for the specific NSDictionary that contains a match for the search terms. That's a secondary issue however. Any help would be greatly appreciated. </p>