replace all in JavaScript
Maybe you already had the problem that you needed to use a a simple replace in JavaScript. The problem is while using "string.replace('old string', 'new string')" just the first match will be replaced. This is kind of weird if you are coming from the .Net world. So there are two ways to perform a replace all in JavaScript: the replacing with arrays and the regex replacing