Test case details

Preparation Code

var mystring = 'okay.this.is.a.string.that.is.dot.separated'; var constructedStatic = new RegExp("\\.","g"); var shorthandStatic = /\./g; String.prototype.loopReplace = function(replacee,replacer){ var result = this; while(!!~(result = result.replace('.',' ')).indexOf('.')){} return result; }

Test cases

Test #1

result = mystring.replace(shorthandStatic," ");

Test #2

result = mystring.replace(constructedStatic," ");

Test #3

result = mystring.replace(new RegExp("\\.","g")," ");

Test #4

result = mystring.replace(/\./g,' ');

Test #5

result = mystring.split('.').join(' ');

Test #6

result = mystring.loopReplace('.',' ');