Is there a way to replace the word "has" with "had" in a string without affecting instances of the word "hash" that contains the substring "has"? I'm currently using the function below but it also replaces "has" within "hash". Any suggestions on how to address this issue?
function replace() {
sentence = sentence.replaceAll("has", "had");
}