Code example for Matcher

Methods: find, group, groupCount

0
        if (htmlText == null) {
            return null; 
        } 
 
        Matcher m = styleColorPattern.matcher(htmlText);
        while (m.find() && m.groupCount() == 3) {
            Integer n1 = Integer.valueOf(m.group(1));
            Integer n2 = Integer.valueOf(m.group(2));
            Integer n3 = Integer.valueOf(m.group(3));
            int c = Color.rgb(n1, n2, n3);
 
            return c;
        } 
        return null; 
    } 
 
    public static String getStringFontColor(String htmlText) {
        Integer color = getIntFontColor(htmlText);
 
        if (color != null) {
            return String.format("#%06X", (0xFFFFFF & color));