fix to issue #6

fix to issue #6
String.replace() invoked with function to avoid "$&" being replaced with search pattern.