I\'m not very sure there is any regex to replace thoese things:
This is a string value read from a xml file saved through Linux machine
This should take care of fixing slashes:
String str = xml.replaceAll("\\\\|/", System.getProperty("file.separator"));
Use the "file.separator" system property and base your regexp on that.
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
Also see this: File.separator vs FileSystem.getSeparator() vs System.getProperty("file.separator")?
str = str.replaceAll("\\\\|/", "\\"+System.getProperty("file.separator"))