Now, this is scarce a specification. You didn't even bother to tell people WHAT the "word three match" should be, and how to generate the replacement string.
Please become accustomed to provide decent context info of your problem.
It is always helpful to support a request with system info like OS and shell, related environment (variables, options), preferred tools, and adequate (representative) sample input and desired output data and the logics connecting the two, to avoid ambiguities and keep people from guessing.