我已经从这个答案中获取了匹配斜杠和反斜杠的正则表达式:Regex to match both slash in JAVA
String path = "C:\\system/properties\\\\all//";
String replaced = path.replaceAll("[/\\\\]+",
System.getProperty("file.separator"));
但是,我收到错误:
线程“主”java.lang.StringIndexOutOfBoundsException 中的异常:字符串索引超出范围:1
这个正则表达式有什么问题?删除+
不会改变任何东西,错误消息是一样的......