| Real'sHowTo |
|
|
Custom Search
|
| Real'sHowTo |
|
|
Custom Search
|
So the regex expression to replace "\" to "\\" is
public class Test {
public static void main(String[] args){
String text = "\\\\server\\apps\\file.txt";
System.out.println("original : " + text);
System.out.println("converted : " + text.replaceAll("\\\\","\\\\\\\\"));
/*
output :
original : \\server\apps\file.txt
converted : \\\\server\\apps\\file.txt
*/
}
}
See also this HowTo.
Written and compiled by Réal Gagnon ©1998-2013
[ home ]