Merge pull request #3564 from wanderingmeow/fix-regexp-safari-before-16.4

fix: RegExp "invalid group specifier name" exception on Safari < 16.4
This commit is contained in:
Timothy Jaeryang Baek 2024-06-30 22:40:53 -07:00 committed by GitHub
commit f3c1ff9efc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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