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+)",");
原文地址:https://www.cnblogs.com/zhshlimi/p/9023045.html