我需要的,看起来像一个文件匹配和解析数据:Java正则表达式用连字符
4801-1-21-652-1-282098
4801-1-21-652-2-282098
4801-1-21-652-3-282098
4801-1-21-652-4-282098
4801-1-21-652-5-282098
,但我下面写的模式似乎并没有工作。有人能帮我理解为什么吗?
final String patternStr = "(\\d+)-(\\d+)-(\\d+)-(\\d+)-(\\d+)-(\\d+)";
final Pattern p = Pattern.compile(patternStr);
while ((this.currentLine = this.reader.readLine()) != null) {
final Matcher m = p.matcher(this.currentLine);
if (m.matches()) {
System.out.println("SUCCESS");
}
}
这正是最新的错 – 2010-12-17 23:26:21