So I want to take in a string, and test for a series of possible words that might be contained in that string, and if any of those words do occur in the string, i want to replace those with a specific word, in this case "is".
function replace_is (string) {
var exps = [/looks/, /appears/, /seems/, /feels/];
for(i = 0;i<exps.length;i++) {
if (string.search(exps[i])==-1) {
continue;
}
else {
string.replace(exps[i], "is")
return string;
}
}
return false;
}
Problem is, this does not work. What is a better way to do this? Or why might this not be working?