Replace All Occurrences in a String var tokenRegex = new RegExp('{{TOKEN}}', 'g'); myString.replace(tokenRegex, myTokenValue);