mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-14 11:10:40 +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);
|
return haystack.includes(transformedString);
|
||||||
}
|
}
|
||||||
else {
|
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)) {
|
if (regex.test(haystack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user