我有一个包含以下数据的文件:
recv(1178884, NULL, 4294967267, 0) = 0
......
......
我的源代码是:
try (BufferedReader br = new BufferedReader(new FileReader("D:\\smsTrace.txt"))) {
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
String sysCallName = sCurrentLine;
String[] sysCallTokens = sysCallName.split("(");
System.out.println(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
}
当我用sysCallName.split(“,”)分割时,它工作正常,但是当我使用如上,它会引发以下异常。
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed group near index 1
(
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.accept(Unknown Source)
at java.util.regex.Pattern.group0(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.split(Unknown Source)
at java.lang.String.split(Unknown Source)
at fileReading.main(fileReading.java:19)
任何想法我做错了什么?