Replace All in Javascript
From Code Trash
String.prototype.replaceAll = function(replaceThis, withThis) { this.replace(/replaceThis/g, withThis); };
Here, tinypath is a variable which holds some value
content = content.replace(/src=\"+tinypath/g,"src=\"") // alert(content) content = content.replace(/src=\"/g,"src=\""+tinypath) // alert(content)