Created
April 29, 2015 02:29
-
-
Save JavaScript-Packer/175019a2007ad57beb47 to your computer and use it in GitHub Desktop.
A JavaScript function that multi replaces many things to one same thing, use any regexp for split
This file contains 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
function replacer(s, f, r) { | |
//s=string | |
//f=find | |
//r=replace | |
return s.split(RegExp(eval(f))).join(r); | |
} | |
alert(replacer("480Vi76s76i5t7 7w5876w87w58.5W76H2A56K.2134c54o67m0", "/[0-9]/g", "")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment