fix: RegExp "invalid group specifier name" exception on Safari < 16.4 (#3306, #3371)

This commit is contained in:
WanderingMeow 2024-07-01 10:42:55 +08:00 committed by GitHub
parent 5d1573fd1b
commit de3d49000e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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) => {