我的字符串:
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]
等等
什么是正确的模式?