Does anyone know any regex expression where I can replace a word found in a string with another string?
var replacement = "car";
var toReplace = "boat";
var str = "banana boats or boat"
str = str.replace(toReplace, replacement);
I want str to be equals to "banana boats or car" instead of "banana cars or car"
Any suggestions?