"The input string can contain any number of delimiters, followed by the word we are searching for, and then any delimiter or else the end of the string. If we find the word, return ??? what exactly? Or, if we don't find the word, then there can be any characters or delimiters to the end. (And then what does the "end skip" do?)
I should start by saying that I don't normally use
return in this way: I don't much for
return at all, rather let all the branches play out to their conclusion. I used it here for expediency.
The problem here is defined as 'whole words'--we need to discern what a whole word is. In Regex, you might write
/\bWordToMatch\b/ with that handy little
\b shorthand which is a zero-width match between a stream of
\w (word) chara