Hi all,
Im trying to find the 3 preceding and following words for a search keyword in a textfile using the following expression:
(\w+) (\w+) (\w+)) \bkeyword\b (\w+) (\w+) (\w+)
The problem is if the keyword is detected as one of (\w+)'s then the regex engine will bypass it and will not be matched by the regular expression.
For example if I have the following sentence and I search for the keyword very is will be detected only once because the second very will be included in the first match:
I am really very happy and very excited as well.
Any idea on how to get all the matches of a keyword in this situation?
Thanks
Roberto
Im trying to find the 3 preceding and following words for a search keyword in a textfile using the following expression:
(\w+) (\w+) (\w+)) \bkeyword\b (\w+) (\w+) (\w+)
The problem is if the keyword is detected as one of (\w+)'s then the regex engine will bypass it and will not be matched by the regular expression.
For example if I have the following sentence and I search for the keyword very is will be detected only once because the second very will be included in the first match:
I am really very happy and very excited as well.
Any idea on how to get all the matches of a keyword in this situation?
Thanks
Roberto