Filter array using pattern

I have an array of words(all the words are in NSMutableArray). I need to filter the words as shown below.

???? - Any four letter word ma?t* - Any word that starts with the letters “ma” and has a “t” as the forth letter. z - Any word that contains the letter “z” ?n?t? - Any five letter word with ”n” as the second letter and “t” as the forth letter. *s*b* - Any word that contains the letter “s” and then the letter “b” in the remaining letters. mouth  - The word “moth” will be returned if it exists in the current Word List t*s? - Any words that start with the letter “t” , is at least three letters long and has “s” as the second last letter in the word. * - Returns all words in the Word List.


you can use the below code for filter using pattern

-(NSMutableArray *)searchByPattern:(NSString *)patternString inputArray:(NSMutableArray *)inputArray
    NSLog(@"orginal Array count=%d",[inputArray count]);
    NSString *match=[NSString stringWithFormat:@"%@",patternString];
    NSLog(@"match = %@",match);
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF like %@",match];    
    NSMutableArray *mArrayFiltered = [[inputArray filteredArrayUsingPredicate:predicate] mutableCopy];
    //NSLog(@"mArrayFiltered = %@ count = %d",mArrayFiltered,[mArrayFiltered count]);
    return mArrayFiltered;

Need Your Help

Make the scrollbar fixed to bottom even while appending content to it

javascript jquery

For better understanding I am trying to implement chatbox with smooth transition of previous (upper) chat messages.