【修改参数正则解析逻辑】

This commit is contained in:
weizhihong 2023-04-10 10:25:00 +08:00
parent 26719b4685
commit 35b1287875

View File

@ -102,9 +102,11 @@ public class VoiceParseServiceImpl implements VoiceParseService {
private List<String> keyWordsMatch(String patternStr, String content) {
List<String> groupList = new ArrayList<>();
Pattern pattern = Pattern.compile(patternStr);// 匹配的模式
Matcher m = pattern.matcher(content);
if (m.find()) {
groupList.add(m.group());
Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
for (int index = 1, size = matcher.groupCount(); index <= size; index++) {
groupList.add(matcher.group(index));
}
}
return groupList;
}