From fa7cb324270f81ed626d45f2aca8a215dfa5104e Mon Sep 17 00:00:00 2001 From: Lars Willighagen Date: Sat, 12 May 2018 00:18:30 +0200 Subject: [PATCH] [output] Fix flagged REDOS regex Fix some of the regexes flagged by the eslint REDOS plugin. See #107 --- src/get/modules/csl/affix.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/get/modules/csl/affix.js b/src/get/modules/csl/affix.js index 2d575a6..0064ebc 100644 --- a/src/get/modules/csl/affix.js +++ b/src/get/modules/csl/affix.js @@ -14,7 +14,9 @@ */ const getAffix = (source, affix) => typeof affix === 'function' ? affix(source) : typeof affix === 'string' ? affix : '' -const htmlRegex = /^(\s*<[a-z0-9:-]+(?:\s*[a-z0-9:-]+=(?:"(?:\\\\|\\"|[^"])*"|'(?:\\\\|\\'|[^'])*'|\w+))*\s*>)([\s\S]+)(<\/[a-z:]+>\s*)$/i +// This simplified Regex only fails when one of the attributes of the top-level +// element contains a right angle bracket (">"). +const htmlRegex = /^([^>]+>)([\s\S]+)(<[^<]+)$/i /** * Pre/append things to entry