You only need to make a change to your regex. So as not to fall foul of the forum police I'm going to try to describe what is needed without actually giving you the completed regex. Currently your regex only captures the word being searched for so you need to prefix it so as to also match anything up to that word and anything after that word. There are a couple of points to note -
1) If you want to match only isolated words then you will need to make sure the word starts and ends on a word boundary.
2)
You should really make sure that any regex meta characters in the word are 'escaped' or you may get unexpected matches.
I surmise from your earlier post that this text you are searching is being read from a file and it seems that you are reading the whole file into memory. This is normally a bad idea since it does not scale well. Your current requirement would be much easier if you did not read the whole file into memory but only read a line at a time.