use regex to find/replace in a string

From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace