Say I have this string:
cat hates dog
When i do a replace :
str = str.replace('cat', 'fish');
I will only get "cat" replaced by "fish" , how to get it works like this:
- "cat" replaced by "fish"
- "other string"(else) replaced by "goat"
so I will get new string:
fish goat goat