index-of-match-end.js 300 B

123456789
  1. function indexOfMatchEnd(xml, pattern, startIndex) {
  2. const re = new RegExp(pattern);
  3. const match = re.exec(xml.slice(startIndex));
  4. if (match) return startIndex + match.index + match[0].length - 1;
  5. else return -1;
  6. }
  7. module.exports = indexOfMatchEnd;
  8. module.exports.default = indexOfMatchEnd;