javascript Programming Glossary: mapobj
Replace multiple strings with multiple other strings http://stackoverflow.com/questions/15604140/replace-multiple-strings-with-multiple-other-strings each one. var str I have a cat a dog and a goat. var mapObj cat dog dog goat goat cat str str.replace cat dog goat gi function.. str str.replace cat dog goat gi function matched return mapObj matched jsfiddle example Generalizing it If you want to dynamically.. to the map you can do this new RegExpr Object.keys mapObj .join gi to generate the regex. So then it would look like this..
|