从配置文件中读取一段字符,用了正则表达式进行截取字段,读取出来的字符如下
GETTRUNCATES
table txndba.txn_proc_result_100;
table txndba.txn_proc_result_220;
table txndba.txn_proc_result_240;
table txndba.txn_proc_result_311;
table txndba.txn_proc_result_431;
table txndba.txn_proc_reslut_451;
table txndba.txn_proc_result_531;
表达式如下
Pattern p = Pattern.compile("(?<=txn_proc_result_)\\d+");
Matcher m = p.matcher(returnOGG);
循环加入list集合
while (m.find()) {
resultList.add(m.group());
}
按理说应该取出7个字段,但是只取出6个字段
[100, 220, 240, 311, 431, 531]