I need a regex that will match at most 5 words before and after a certain word. Example:
the certain word is “the”
the string is “John Ely gets start for the Dodgers, while old friend Takashi Saito gets start for the Brewers in what will essentially be a bullpen game for Milwaukee.”
There should be 2 results:
John Ely gets start for the Dodgers, while old friend Takashi
Takashi Saito gets start for the Brewers in what will essentially
Any ideas???
Thanks
Note however that most regex engines won’t deal with overlapping matches.