Hiya, I have this regex to replace all instances of myWord: String oldWord = "oldWord"; String newWord = "newWord"; String sentence = "some sentence that contains " + oldWord; String newSentence = replaceWordsInSentence(sentence, oldWord, newWord); private String replaceWordsInSentence(String sentence, String oldWord, String newWord) { return sentence.replaceAll("\b" + oldWord + "\b", newWord); } ...it works in most instances, but when oldWord is ...