I am new to javascript and trying to do some advanced string splitting/replacement.
I have researched all over and read the common SO solutions but no luck.
I am trying to convert this string:
var feeling = "my code makes me {{ unhappy }}"
// your magic code here
console.log(feeling) >> "my code makes me happy!" // desired outcome
So i am trying to replace the brackets and words in them, with a new word..
I tried
feeling.replace(/{{.*}}/, 'happy !')
but it's not working.
Thank you!
replacefunction as it does not modify the string:console.log(feeling.replace(/{{.*}}/, 'happy !'))will show the desired output.