RegExpress
var str="Mr Blue has a blue house and a blue car";
undefined
console.log(str)
VM203:1 Mr Blue has a blue house and a blue car
undefined
var str="Mr Blue has a .blue house and a blue. car";
undefined
var n=str.replace(/blue/g,"red")
undefined
console.log(n)
VM347:1 Mr Blue has a .red house and a red. car
undefined
var n=str.replace(/\.blue/g,"red")
undefined
console.log(n)
VM363:1 Mr Blue has a red house and a blue. car