mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02: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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user