in reply to find words around a word in a file.

The real problem here is to define what a "word" is. /\b\w+\b/ would not capture hyphenated words, and only capture accented characters if the string is in UTF-8 format, or if you use the /u modifier (need 5.14 for that). It also captures digits and underscores. /[a-zA-Z]+/ works fine if all your input data is ASCII. /\pL+/ captures strings of "letter" characters, but can capture strings that combine letters from different scripts.

And neither of the above will deal with words like don't very well. So, before you ponder how to find a next of a previous word, consider how you find a word.