mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-12 10:00:36 +01:00
Merge pull request #2169 from Wolfsblvt/fix-wi-whole-world
Fixes WI word matching not working for non-words
This commit is contained in:
commit
51f0d1f33e
@ -192,7 +192,8 @@ class WorldInfoBuffer {
|
||||
return haystack.includes(transformedString);
|
||||
}
|
||||
else {
|
||||
const regex = new RegExp(`\\b${escapeRegex(transformedString)}\\b`);
|
||||
// Use custom boundaries to include punctuation and other non-alphanumeric characters
|
||||
const regex = new RegExp(`(?:^|\\W)(${escapeRegex(transformedString)})(?:$|\\W)`);
|
||||
if (regex.test(haystack)) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user