Nodejs Utililty Methods String Replace

List of utility methods to do String Replace

Description

The list of methods to do String Replace are organized into topic(s).

Method

replaceAll(str, replaceStr)
'use strict';
String.prototype.replaceAll = function(str, replaceStr) {
    return this.replace(new RegExp(str, 'gm'), replaceStr);
};
replaceAll(str, replacement)
String.prototype.replaceAll = function(str, replacement) {
  var regex;
  regex = new RegExp(str, "ig");
  return this.replace(regex, replacement);
};
replaceAll(str1, str2, ignore)
String.prototype.replaceAll = function(str1, str2, ignore) 
  return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),(ignore?"gi":"g")),(typeof(str2)=="string")?str2.replace(/\$/g,"$$$$"):str2);
replaceAll(str1, str2, ignore)
'use strict';
String.prototype.replaceAll = function(str1, str2, ignore) 
    return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),(ignore?"gi":"g")),(typeof(str2)=="string")?str2.replace(/\$/g,"$$$$"):str2);
replaceAll(str1,str2)
String.prototype.replaceAll= function(str1,str2){
    return this.replace(new RegExp(str1,"gm"),str2);  
};
replaceAll(strReplace, strWith)
String.prototype.replaceAll = function(strReplace, strWith) {
    var reg = new RegExp(strReplace, 'ig');
    return this.replace(reg, strWith);
};
replaceAll(string, find, replace)
function replaceAll(string, find, replace) {
  return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
replaceAll(stringAntiga, stringNova)
String.prototype.replaceAll = function (stringAntiga, stringNova) {
    return this.split(stringAntiga).join(stringNova);
};
replaceAll(stringToFind,stringToReplace)
karotz.connectAndStart = function(host, port, callback, data){  
    try{
        karotz.connect(host, port);
      log("connected");
      karotz.start(callback, data);
    }catch(err){
      log(err);
};
...
replaceAll(substr, newstring)
String.prototype.replaceAll = function(substr, newstring){
    var temp = this;
    var index = temp.indexOf(substr);
    while(index != -1){
        temp = temp.replace(substr, newstring);
        index = temp.indexOf(substr);
    return temp;