Javascript: Passing a function with matches to replace( regex, func(arg) ) doesn't work Javascript: Passing a function with matches to replace( regex, func(arg) ) doesn't work google-chrome google-chrome