For one NSString, I have N pattern strings. I'd like to extract substrings "around" the pattern matches.
So, if i have "the quick brown fox jumped over the lazy dog" and my patterns are "brown" and "lazy" i would like to get "quick brown fox" and "the lazy dog." However, the substrings don't necessarily need to be delimited by whitespace.
Another example would be if you had multiple paragraphs of text and wanted to find all instances of "red" and "blue" in the text, but you wanted to show the instances of "red" and "blue" in context, but by "context" you didn't care if the context started and ended with the beginnings or endings of words in the body of text, so if you had one of the sentences in the body of text as "there are a whole lot of red ducks in the trees" the result could be "whole lot of red ducks in" or "ole lot of red ducks in th" and it wouldn't matter -- i'm not looking for a whitespace based solution. it could just be to find "red" and get the substring that is "red" and the 10 characters before and the 10 characters after.
In other words, there are some "range" based string matching functions. I was hoping there was an easy way to match multiple strings at once and return each string's matching point plus surrounding characters.