我的字符串:Java的匹配器错误
null[00:14.04]I've /n[00:14.11]got /n[00:14.18]a /n[00:14.25]fee- /n[00:15.02]ling /n
我试图获得之间的每一个数据[< --->]括号中。这是我的代码。
String find = "[(.*?)\\\\]";
Pattern patern = Pattern.compile(find);
Matcher matcher = patern.matcher(intake);
while(matcher.find()){
i++;
matcher.find(i);
int start = matcher.start();
int end = matcher.end();
String group = matcher.group();
}
初步结果:
start = 10
end = 11
group = "."
我想要的是(在我的头上计数)
start = 4
end = 14
group = [00:14.04]
接下来是
start = 22
end = 32
group = [00:14.11]
等
什么是正确的模式?
所以你希望它匹配并返回'[]'括号内的所有内容,那么所有的时间戳?你在“想要”中说什么不清楚。 – Walls 2013-04-04 14:31:25