I'm trying to replace a word with another word, specifically "has" with "had". But the string contains the word "hash" which has the substring "has" so it also gets replaced. What can I do to fix this?
function replace() {
sentence = sentence.replaceAll("has", "had");
}