java正则表达式

public static String match(String p, String str){
        Pattern pattern = Pattern.compile(p);
        Matcher matcher = pattern.matcher(str);
        while (matcher.find()) {
            return matcher.group(1);
        }
        return null;
    }

你可能感兴趣的:(java正则表达式)