private static boolean
    backrefMatcher(REGlobalData gData, int parenIndex,
                   char[] chars, int end)
    {
        int len;
        int i;
        int parenContent = gData.parens_index(parenIndex);
        if (parenContent == -1)
            return true;

        len = gData.parens_length(parenIndex);
        if ((gData.cp + len) > end)
            return false;

        if ((gData.regexp.flags & JSREG_FOLD) != 0) {
            for (i = 0; i < len; i++) {
                if (upcase(chars[parenContent + i]) != upcase(chars[gData.cp + i]))
                    return false;
            }
        }
        else {
            for (i = 0; i < len; i++) {
                if (chars[parenContent + i] != chars[gData.cp + i])
                    return false;
            }
        }
        gData.cp += len;
        return true;
    }