From e904f011f63b76bc1e476d4422740fb968285772 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Wed, 22 Mar 2023 23:21:52 +0000 Subject: [PATCH] Change RegExp to only support two nested square brackets --- module/apps/coc7-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/apps/coc7-parser.js b/module/apps/coc7-parser.js index 2f4e3f8d..0fd06a4f 100644 --- a/module/apps/coc7-parser.js +++ b/module/apps/coc7-parser.js @@ -9,7 +9,7 @@ export class CoC7Parser { let text = [] text = TextEditor._getTextNodes(html) - const rgx = new RegExp('@(coc7)\\.' + '([^\\]]+?)' + '\\[((?:[^\\]\\[]+|\\[(?:[^\\]\\[]+|\\[[^\\]\\[]*\\])*\\])*)\\]' + '(?:{([^}]+)})?', 'gi') + const rgx = new RegExp('@(coc7)\\.' + '(check|effect|item|sanloss)' + '\\[([^\\[\\]]*(?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\])*[^\\[\\]]*\\])*[^\\[\\]]*)\\]' + '(?:{([^}]+)})?', 'gi') TextEditor._replaceTextContent(text, rgx, CoC7Link._createLink) return html.innerHTML }