Allow spaces in wildcard file names

This commit is contained in:
Dominik Reh
2023-02-10 12:23:52 +01:00
parent d29298e0cc
commit b540400110
2 changed files with 3 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
// Regex
const WC_REGEX = /\b__([^, ]+)__([^, ]*)\b/g;
const WC_REGEX = /\b__([^,]+)__([^, ]*)\b/g;
// Trigger conditions
const WC_TRIGGER = () => CFG.useWildcards && [...tagword.matchAll(WC_REGEX)].length > 0;

View File

@@ -287,8 +287,9 @@ function isEnabled() {
const WEIGHT_REGEX = /[([]([^,()[\]:| ]+)(?::(?:\d+(?:\.\d+)?|\.\d+))?[)\]]/g;
const POINTY_REGEX = /<[^\s,<](?:[^\t\n\r,<>]*>|[^\t\n\r,> ]*)/g;
const COMPLETED_WILDCARD_REGEX = /__[^\s,_][^\t\n\r,_]*[^\s,_]__[^\s,_]*/g;
const NORMAL_TAG_REGEX = /[^\s,|<>]+|</g;
const TAG_REGEX = new RegExp(`${POINTY_REGEX.source}|${NORMAL_TAG_REGEX.source}`, "g");
const TAG_REGEX = new RegExp(`${POINTY_REGEX.source}|${COMPLETED_WILDCARD_REGEX.source}|${NORMAL_TAG_REGEX.source}`, "g");
// On click, insert the tag into the prompt textbox with respect to the cursor position
async function insertTextAtCursor(textArea, result, tagword) {