UNPKG

xml-utils

Version:

Parse XML without Blowing Up Your Bundle Size

7 lines (6 loc) 238 B
export default function indexOfMatchEnd(xml, pattern, startIndex) { const re = new RegExp(pattern); const match = re.exec(xml.slice(startIndex)); if (match) return startIndex + match.index + match[0].length - 1; else return -1; }