Nodejs String Replace replaceAll(search, replacement)

Here you can find the source of replaceAll(search, replacement)

Method Source Code

String.prototype.replaceAll = function(search, replacement) {
  'use strict';/*from  w ww  .  j  a  v  a 2  s.c  o  m*/
  return this.split(search).join(replacement);
};

Related

  1. replaceAll(search, replace)
    String.prototype.replaceAll = function (search, replace) {
        'use strict';
        return this.split(search).join(replace);
    };
    
  2. replaceAll(search, replace)
    String.prototype.replaceAll = function(search, replace){
      return this.split(search).join(replace);
    
  3. replaceAll(search, replace)
    String.prototype.replaceAll = function(search, replace) {
      if(!replace) {
        return this;
      return this.replace(new RegExp(helpers.escapeRegExp(search), 'g'), replace);
    };
    
  4. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        var target = this;
        return target.split(search).join(replacement);
    };
    
  5. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        var target = this;
        return target.replace(new RegExp(search, 'g'), replacement);
    };
    
  6. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        let target = this;
        return target.replace(new RegExp(search, 'g'), replacement);
    };
    
  7. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        var target = this;
        return target.split(search).join(replacement);
    };
    
  8. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        var target = this;
        return target.split(search).join(replacement);
    };
    for (var i=0; i<size(); i++) {
        var item = str(read(i));
        print("(" + i + ")" + " " + item.replaceAll("\\n", "(newline)") + "\\n");
    
  9. replaceAll(search, replacement)
    String.prototype.replaceAll = function(search, replacement) {
        const target = this;
        return target
            .split(search)
            .join(replacement);
    };