Nodejs String Replace replaceAll(replacedText, replaceText)

Here you can find the source of replaceAll(replacedText, replaceText)

Method Source Code

String.prototype.replaceAll = function(replacedText, replaceText){
   return this.replace(new RegExp(replacedText, 'gm'), replaceText)
}

Related

  1. replaceAll(origin, replace)
    String.prototype.replaceAll = function(origin, replace){
      var regexp = new RegExp(origin,'g');
      return this.replace(regexp,replace);
    };
    
  2. replaceAll(reallyDo, replaceWith, ignoreCase)
    String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
        if (!RegExp.prototype.isPrototypeOf(reallyDo)) {
            return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi": "g")), replaceWith);
        } else {
            return this.replace(reallyDo, replaceWith);
    };
    
  3. replaceAll(reallyDo, replaceWith, ignoreCase)
    String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
      if (!RegExp.prototype.isPrototypeOf(reallyDo))
        return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi" : "g")),
            replaceWith);
      else
        return this.replace(reallyDo, replaceWith);
    };
    
  4. replaceAll(reallyDo, replaceWith, ignoreCase)
    String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
      if (!RegExp.prototype.isPrototypeOf(reallyDo))
        return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi" : "g")),
            replaceWith);
      else
        return this.replace(reallyDo, replaceWith);
    };
    String.prototype.charLength = function() {
      var len = 0;
    ...
    
  5. replaceAll(replace, value)
    String.prototype.replaceAll = function (replace, value) {
        return this.replace(new RegExp(replace, 'g'), value);
    };
    
  6. replaceAll(s1, s2)
    String.prototype.replaceAll = function(s1, s2) {
        return this.replace(new RegExp(s1, "gm"), s2)
    
  7. replaceAll(s1, s2)
    String.prototype.replaceAll = function(s1, s2) {
        return this.replace(new RegExp(s1, "gm"), s2); 
    };
    String.prototype.replaceAll2Excep = function(s1, s2) {
        var temp = this;
        while (temp.indexOf(s1) != -1) {
            temp = temp.replace(s1, s2);
        return temp;
    ...
    
  8. replaceAll(search, replace)
    String.prototype.replaceAll = function (search, replace) {
        var string        = this,
            replaceLength = replace.length,
            searchLength  = search.length,
            start         = string.indexOf(search);
        while (start !== -1) {
            string = string.substring(0, start) + replace + string.substring(start + search.length);
            start  = string.indexOf(search, start + replaceLength);
        return string;
    };
    
  9. replaceAll(search, replace)
    String.prototype.replaceAll = function(search, replace)
        if(!replace) 
            return this;
        return this.replace(new RegExp('[' + search + ']', 'g'), replace);
    };
    trim11 = function (str) {
        str = str.replace(/^\s+/, '');
        for (var i = str.length - 1; i >= 0; i--) {
    ...