function addMatch(match) {
        if (item.backref) {
            const ERR_UNDEFINED_GROUP = `Backreference to undefined group: ${item.backref}`;
            const isNamedBackref = isNaN(item.backref);

            if (isNamedBackref && XRegExp.isInstalled('namespacing')) {
                // `groups` has `null` as prototype, so using `in` instead of `hasOwnProperty`
                if (!(match.groups && item.backref in match.groups)) {
                    throw new ReferenceError(ERR_UNDEFINED_GROUP);
                }
            } else if (!match.hasOwnProperty(item.backref)) {
                throw new ReferenceError(ERR_UNDEFINED_GROUP);
            }

            const backrefValue = isNamedBackref && XRegExp.isInstalled('namespacing') ?
                match.groups[item.backref] :
                match[item.backref];

            matches.push(backrefValue || '');
        } else {
            matches.push(match[0]);
        }
    }
Retrieves the matches from searching a string using a chain of regexes that successively search
within previous matches. The provided `chain` array can contain regexes and or objects with
`regex` and `backref` properties. When a backreference is specified, the named or numbered
backreference is passed forward to the next regex or returned.

@memberOf XRegExp
@param {String} str String to search.
@param {Array} chain Regexes that each search for matches within preceding results.
@returns {Array} Matches by the last regex in the chain, or an empty array.
@example

// Basic usage; matches numbers within <b> tags
XRegExp.matchChain('1 <b>2</b> 3 <b>4 a 56</b>', [
  XRegExp('(?is)<b>.*?</b>'),
  /\d+/
]);
// -> ['2', '4', '56']

// Passing forward and returning specific backreferences
const html = `<a href="http://xregexp.com/api/">XRegExp</a>
              <a href="http://www.google.com/">Google</a>`;
XRegExp.matchChain(html, [
  {regex: /<a href="([^"]+)">/i, backref: 1},
  {regex: XRegExp('(?i)^https?://(?<domain>[^/?#]+)'), backref: 'domain'}
]);
// -> ['xregexp.com', 'www.google.com']