Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created May 1, 2015 07:26
Show Gist options
  • Select an option

  • Save JavaScript-Packer/be4709c5bdf1a5e62715 to your computer and use it in GitHub Desktop.

Select an option

Save JavaScript-Packer/be4709c5bdf1a5e62715 to your computer and use it in GitHub Desktop.
My favorite function for search and replace in JavaScript
function replaceAllExact(str,find,replace){
return str.split(find).join(replace)
};
alert(replaceAllExact('Google VS. www.google.com','google','seekfreak'));
//minified
//function i(i,a,e){return i.split(a).join(e)}alert(i("Google VS. www.google.com","google","seekfreak"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment