Pattern test = Pattern.compile("test");
String string="test";
String ans=test.matcher(string).replaceAll("\\\\");

これを実行するとうまくいかないんですが
バグですかね・・・

ちなみに
\\
になるはずですが
結果は
\
です