Design a function that would perform the search and replace function found in MS Word.
Anoniem
Must consider all possible cases that can be thrown at the function that may cause it to fail including words that may contain the word to be replaced as well as words in languages where they are read from right to left rather than left to right.