Skip to content

Commit

Permalink
added index-of-match-end.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Jun 3, 2022
1 parent 77b5970 commit 4795880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index-of-match-end.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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;
}

module.exports = indexOfMatchEnd;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"find-tags-by-path.js",
"get-attribute.js",
"index-of-match.js",
"index-of-match-end.js",
"index.js"
],
"scripts": {
Expand Down

0 comments on commit 4795880

Please sign in to comment.