diff --git a/index.js b/index.js index 6b37139..e75ce96 100644 --- a/index.js +++ b/index.js @@ -16,8 +16,7 @@ function getDelimiters (tag) { // Escape inner text between delimiters function escapeTextInDelimiters (str, start, end) { - var middleTextRegex = new RegExp(start + '(.*)' + end) - var middleText = str.match(middleTextRegex)[1] + var middleText = str.slice(start.length, end.length * -1) return start + escapeHtml(middleText) + end } diff --git a/test/xmp-escape-loader.test.js b/test/xmp-escape-loader.test.js index 76b1537..0397198 100644 --- a/test/xmp-escape-loader.test.js +++ b/test/xmp-escape-loader.test.js @@ -13,8 +13,8 @@ test('can receive custom tag', () => { expect(output).toEqual('
<div> Test </div>') }) -test('works on nested tags', () => { - const input = '