Escape "Match whole words" regex
This commit is contained in:
parent
9bd9ddb9e1
commit
08a0709186
|
@ -1,5 +1,5 @@
|
|||
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types } from "../script.js";
|
||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, deepClone, getSortableDelay } from "./utils.js";
|
||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, deepClone, getSortableDelay, escapeRegex } from "./utils.js";
|
||||
import { getContext } from "./extensions.js";
|
||||
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
|
||||
import { registerSlashCommand } from "./slash-commands.js";
|
||||
|
@ -1130,7 +1130,7 @@ function matchKeys(haystack, needle) {
|
|||
return haystack.includes(transformedString);
|
||||
}
|
||||
else {
|
||||
const regex = new RegExp(`\\b${transformedString}\\b`);
|
||||
const regex = new RegExp(`\\b${escapeRegex(transformedString)}\\b`);
|
||||
if (regex.test(haystack)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue