code: function getMatchIndexes(m, captureGroup) {
          captureGroup = captureGroup || 0;
  
          if (!m[0]) {
            throw 'findAndReplaceDOMText cannot handle zero-length matches';
          }
  
          var index = m.index;
  
          if (captureGroup > 0) {
            var cg = m[captureGroup];
  
            if (!cg) {
              throw 'Invalid capture group';
            }
  
            index += m[0].indexOf(cg);
            m[0] = cg;
          }
  
          return [index, index + m[0].length, [m[0]]];
        }
docs: BR, IMG, INPUT