when calling the replaceAll function on java.lang.String with a backslash :
println 'xxxx'.replaceAll('x',{'\\'})
I get the following exception:
Caught: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
any other character does not cause the same exception
println 'xyxyx'.replaceAll('x',{'\\\\'}) // => \y\y\Groovy provides the slashy string syntax to save you from having to use 4 backslahes but for cases involving only backslahes, the slashy string syntax might add more confusion because of its special escaping rules for escaping slashes.