Home / Javascript Tips Generated By ChatGPT / Using String.replace with Regular Expressions in Javascript Replace parts of a string using regular expressions. Source Code let text = 'Hello, world!'; console.log(text.replace(/world/, 'JavaScript'));