Nodejs String Replace replaceAll(reallyDo, replaceWith, ignoreCase)

Here you can find the source of replaceAll(reallyDo, replaceWith, ignoreCase)

Method Source Code

String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) {
   if (!RegExp.prototype.isPrototypeOf(reallyDo))
      return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi" : "g")),
            replaceWith);//from w  w w .  ja v  a 2 s .c o m
   else
      return this.replace(reallyDo, replaceWith);
};

Related

  1. replaceAll(org, dest)
    String.prototype.replaceAll = function(org, dest) {
      var data = this;
      if (org instanceof Array) {
        org.forEach(function(elm) {
          data = data.split(elm).join(dest);
        });
        return data;
      } else {
        return data.split(org).join(dest);
    ...
    
  2. replaceAll(org, dest)
    String.prototype.replaceAll = function(org, dest) {
        return this.split(org).join(dest);
    
  3. replaceAll(org, tag)
    String.prototype.replaceAll = function(org, tag){
      return this.replace(new RegExp(org, 'g'), tag);
    };
    
  4. replaceAll(origin, replace)
    String.prototype.replaceAll = function(origin, replace){
      var regexp = new RegExp(origin,'g');
      return this.replace(regexp,replace);
    };
    
  5. 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);
    };
    
  6. 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;
    ...
    
  7. replaceAll(replace, value)
    String.prototype.replaceAll = function (replace, value) {
        return this.replace(new RegExp(replace, 'g'), value);
    };
    
  8. replaceAll(replacedText, replaceText)
    String.prototype.replaceAll = function(replacedText, replaceText){
      return this.replace(new RegExp(replacedText, 'gm'), replaceText)
    
  9. replaceAll(s1, s2)
    String.prototype.replaceAll = function(s1, s2) {
        return this.replace(new RegExp(s1, "gm"), s2)