From de3d49000e89f5cb88995627fd257ddaf0355e66 Mon Sep 17 00:00:00 2001 From: WanderingMeow <128711250+wanderingmeow@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:42:55 +0800 Subject: [PATCH] fix: RegExp "invalid group specifier name" exception on Safari < 16.4 (#3306, #3371) --- src/lib/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index d80fcc799..af3ab9a01 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -525,7 +525,7 @@ export const extractSentences = (text) => { }); // Split the modified text into sentences based on common punctuation marks, avoiding these blocks - let sentences = text.split(/(?<=[.!?])\s+/); + let sentences = text.match(/[^.?!]+[.!?]+[\])'"`’”]*|.+/g); // Restore code blocks and process sentences sentences = sentences.map((sentence) => {