How to replace string in Groovy February 19, 2023 by Tarik You need to escape the backslash \: println yourString.replace("\\", "https://stackoverflow.com/")