diff --git a/mustache.js b/mustache.js index c5be0c9..3535e66 100644 --- a/mustache.js +++ b/mustache.js @@ -47,7 +47,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {}; }; var quote = (typeof JSON !== "undefined" && JSON.stringify) || function (string) { - return '"' + String(string).replace(/(^|[^\\])"/g, '\\"') + '"'; + return '"' + String(string).replace(/([\\"])/g, '\\$1') + '"'; }; function escapeRe(string) {