In Objective C, what's the best way to extract multiple substrings of text around multiple patterns?
- by Matt
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.
I have a hunch that there's a very easy solution to this, but I admit a disturbing lack of knowledge of Objective C string functions.