html/rainbow/rainbow.js
function _indexOfGroup(match, group_number) {
        var index = 0,
            i;

        for (i = 1; i < group_number; ++i) {
            if (match[i]) {
                index += match[i].length;
            }
        }

        return index;
    }
function _indexOfGroup(match, group_number) {
        var index = 0,
            i;

        for (i = 1; i < group_number; ++i) {
            if (match[i]) {
                index += match[i].length;
            }
        }

        return index;
    }
function _indexOfGroup ( match , group_number ) { var index = 0 , i ; for ( i = 1 ; i < group_number ; ++ i ) { if ( match [ i ] ) { index += match [ i ] . length ; } } return index ; }
finds out the position of group match for a regular expression

@see http://stackoverflow.com/questions/1985594/how-to-find-index-of-groups-in-match

@param {Object} match
@param {number} group_number
@returns {number}
finds out the position of group match for a regular expression