Java正则表达式-捕获组
private Set<String> getCodes(String s) { Set<String> resultSet = new HashSet<>(); Matcher matcher = codePattern.matcher(s); while (matcher.find()) { resultSet.add(matcher.group(1)); } return resultSet; } private static Pattern codePattern = Pattern.compile("\"code\":\"(\\w+)\",");