In Java, I want to replace all *
characters with \*
.
Example:
Text: select * from blah
Result: select \\* from blah
public static void main(String[] args) {
String test = "select * from blah";
test = test.replaceAll("*", "\\*");
System.out.println(test);
}
This does not work, nor does adding a escape backslash.