[Cherry Pick] Fix [Utils] Regex trimTopic

- [+] fix(utils.ts): update regular expressions in trimTopic function to handle asterisks
This commit is contained in:
H0llyW00dzZ 2024-02-21 04:19:12 +07:00
parent e756506c18
commit 22baebaf8c
No known key found for this signature in database
GPG Key ID: 05C7FFFC0845C930
1 changed files with 3 additions and 2 deletions

View File

@ -9,8 +9,9 @@ export function trimTopic(topic: string) {
// This will remove the specified punctuation from the end of the string
// and also trim quotes from both the start and end if they exist.
return topic
.replace(/^["“”]+|["“”]+$/g, "")
.replace(/[,。!?”“"、,.!?]*$/, "");
// fix for gemini
.replace(/^["“”*]+|["“”*]+$/g, "")
.replace(/[,。!?”“"、,.!?*]*$/, "");
}
export async function copyToClipboard(text: string) {