Created
March 14, 2014 14:11
-
-
Save johsh/9548416 to your computer and use it in GitHub Desktop.
js, replaceAll instead of replace (first)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //find = this has to be replaced... | |
| //replace = with that str | |
| //str = in this str, please | |
| function replaceAll(find, replace, str) { | |
| return str.replace(new RegExp(find, 'g'), replace); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment