How to replace string in Groovy

Bilow Yuriy picture Bilow Yuriy · Oct 3, 2016 · Viewed 133.4k times · Source

I have some string like

C:\dev\deploy_test.log

I want by means of Groovy to convert string to

C:/dev/deploy_test.log

I try to perform it with command

Change_1 = Log_file_1.replaceAll('\','/');

It doesn't convert this string

Answer

baao picture baao · Oct 3, 2016

You need to escape the backslash \:

println yourString.replace("\\", "/")