diff --git a/src/components/Embedded/EmbeddedNormalUrl.tsx b/src/components/Embedded/EmbeddedNormalUrl.tsx index aaadbae..fcbb282 100644 --- a/src/components/Embedded/EmbeddedNormalUrl.tsx +++ b/src/components/Embedded/EmbeddedNormalUrl.tsx @@ -15,7 +15,7 @@ export function EmbeddedNormalUrl({ url }: { url: string }) { } export const embeddedNormalUrlRenderer: TEmbeddedRenderer = { - regex: /(https?:\/\/[^\s]+)/g, + regex: /(https?:\/\/[\w\p{L}\p{N}\p{M}&.-/?=#\-@%+_,:!~*]+)/gu, render: (url: string, index: number) => { return } diff --git a/src/components/Embedded/EmbeddedWebsocketUrl.tsx b/src/components/Embedded/EmbeddedWebsocketUrl.tsx index ad447eb..0800be1 100644 --- a/src/components/Embedded/EmbeddedWebsocketUrl.tsx +++ b/src/components/Embedded/EmbeddedWebsocketUrl.tsx @@ -19,7 +19,7 @@ export function EmbeddedWebsocketUrl({ url }: { url: string }) { } export const embeddedWebsocketUrlRenderer: TEmbeddedRenderer = { - regex: /(wss?:\/\/[^\s]+)/g, + regex: /(wss?:\/\/[\w\p{L}\p{N}\p{M}&.-/?=#\-@%+_,:!~*]+)/gu, render: (url: string, index: number) => { return } diff --git a/src/constants.ts b/src/constants.ts index ae3362f..b6e7305 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -23,5 +23,5 @@ export const SEARCHABLE_RELAY_URLS = ['wss://relay.nostr.band/', 'wss://search.n export const PICTURE_EVENT_KIND = 20 export const COMMENT_EVENT_KIND = 1111 -export const URL_REGEX = /(https?:\/\/[^\s"']+)/g +export const URL_REGEX = /https?:\/\/[\w\p{L}\p{N}\p{M}&.-/?=#\-@%+_,:!~*]+/gu export const EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/