I have a large number of sentences, each of them containing at least one occurrence of 'well'. I'd like to get a list of the two words occurring immediately to the left of 'well' and the two words immediately to the right of 'well'. For example, in the sentence
"very well they all three get on well together"
the result should be for left: "NA" "very" "get" "on"
and for right: "they" "all" "together" "NA"
I do suspect that sub() will be useful and regexes but don't know (exactly) how to assemble the query. How can it be done?