23,404
社区成员
发帖
与我相关
我的任务
分享
String str="{\"recordId\":162,\"time\":\"2018-09-12 10:14:37\",\"docadvice\":\"医嘱内容....\",\"isFinish\":0,\"templateName\":\"诊后随访\"},{\"recordId\":165,\"time\":\"2018-09-12 10:16:53\",\"docadvice\":\"医嘱内容....\",\"isFinish\":0,\"templateName\":\"诊后随访\"},{\"recordId\":166,\"time\":\"2018-09-12 10:17:12\",\"docadvice\":\"医嘱内容....\",\"isFinish\":0,\"templateName\":\"诊后随访\"},{\"recordId\":177,\"time\":\"2018-09-12 10:58:35\",\"docadvice\":\"医嘱内容....\",\"isFinish\":1,\"templateName\":\"诊后随访\"}";
String regex="\\{(?=\"[^{}]*isFinish\":0\\b)[^{]*\"recordId\":(\\d+)[^}]*\\}";
Matcher m=Pattern.compile(regex).matcher(str);
List<String> recordIds=new ArrayList<String>();
while(m.find()){
recordIds.add(m.group(1));
}