fix: safari reg error

This commit is contained in:
archer
2023-05-16 14:25:51 +08:00
parent 371e0e36c6
commit 021add2af4
4 changed files with 14 additions and 4 deletions

View File

@@ -117,6 +117,6 @@ export const voiceBroadcast = ({ text }: { text: string }) => {
export const formatLinkTextToHtml = (text: string) => {
const httpReg =
/(?<!\[.*\]\()((http|https|ftp):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)(?![\)])/gi;
/(http|https|ftp):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?/gi;
return text.replace(httpReg, '<a href="$&" target="_blank">$&</a>');
};