Test for lastMatch fix. Also fix jshint error by using a function creation function to create the second param for String.replace.