Skip to content

Instantly share code, notes, and snippets.

@theswedishdev
Last active February 16, 2017 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theswedishdev/8d7d15d8cf97900a930c2ad018c450cb to your computer and use it in GitHub Desktop.
Save theswedishdev/8d7d15d8cf97900a930c2ad018c450cb to your computer and use it in GitHub Desktop.
String.prototype.replaceAll = function(search, replace) {
search = search.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
return this.replace(new RegExp(search, "g"), replace);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment