index.js
function replaceDelimiters(str, source, escape) {
  var regex = cache[source] || (cache[source] = new RegExp(source, 'g'));
  var match;

  while ((match = regex.exec(str))) {
    var prefix = str.slice(0, match.index);
    var inner = (escape ? '\\' : '') + '{{' + match[1] + '}}';
    var suffix = str.slice(match.index + match[0].length);
    str = prefix + inner + suffix;
  }
  return str;
}
function replaceDelimiters(str, source, escape) {
  var regex = cache[source] || (cache[source] = new RegExp(source, 'g'));
  var match;

  while ((match = regex.exec(str))) {
    var prefix = str.slice(0, match.index);
    var inner = (escape ? '\\' : '') + '{{' + match[1] + '}}';
    var suffix = str.slice(match.index + match[0].length);
    str = prefix + inner + suffix;
  }
  return str;
}
function replaceDelimiters ( str , source , escape ) { var regex = cache [ source ] || ( cache [ source ] = new RegExp ( source , 'g' ) ) ; var match ; while ( ( match = regex . exec ( str ) ) ) { var prefix = str . slice ( 0 , match . index ) ; var inner = ( escape ? '\\' : '' ) + '{{' + match [ 1 ] + '}}' ; var suffix = str . slice ( match . index + match [ 0 ] . length ) ; str = prefix + inner + suffix ; } return str ; }
Replace or delimiters in the given string.

```js
var replaced = delimiters.replace(str, ['<%=', '%>']);
```
@name .replace
@param {String} `str` String with handlebars to replace or escape.
@param {String} `source` The delimiters regex source string to conver to a regular expression.
@param {Boolean} `escape` If true, replacements are escaped with a double-slash.
@return {String}
@api public
Replace or delimiters in the given string .