Regex matching for keys and secondary keys
This commit is contained in:
parent
70a2f71e33
commit
5a45e64999
|
@ -194,6 +194,13 @@ class WorldInfoBuffer {
|
||||||
* @returns {boolean} True if the string was found in the buffer
|
* @returns {boolean} True if the string was found in the buffer
|
||||||
*/
|
*/
|
||||||
matchKeys(haystack, needle, entry) {
|
matchKeys(haystack, needle, entry) {
|
||||||
|
// If the needle is a regex, we do regex pattern matching and override all the other options
|
||||||
|
const keyRegex = parseRegexFromString(needle);
|
||||||
|
if (keyRegex) {
|
||||||
|
return keyRegex.test(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise we do normal matching of plaintext with the chosen entry settings
|
||||||
const transformedString = this.#transformString(needle, entry);
|
const transformedString = this.#transformString(needle, entry);
|
||||||
const matchWholeWords = entry.matchWholeWords ?? world_info_match_whole_words;
|
const matchWholeWords = entry.matchWholeWords ?? world_info_match_whole_words;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue