fix hashtags and links with mark char

This commit is contained in:
hzrd149 2023-10-19 08:09:09 -05:00
parent 5d66750768
commit 5ac4cfcb33
3 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix hashtags and links with mark characters in them

View File

@ -19,7 +19,7 @@ export default function OpenGraphCard({ url, ...props }: { url: URL } & Omit<Car
const link = (
<Link href={url.toString()} isExternal color="blue.500">
{url.toString()}
{decodeURI(url.toString())}
</Link>
);

View File

@ -1,8 +1,7 @@
export const getMatchNostrLink = () =>
/(nostr:|@)?((npub|note|nprofile|nevent|nrelay|naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58,})/gi;
export const getMatchHashtag = () => /(^|[^\p{L}])#([\p{L}\p{N}]+)/gu;
export const getMatchLink = () =>
/https?:\/\/([a-zA-Z0-9\.\-]+\.[a-zA-Z]+)([\p{Letter}\p{Number}&\.-\/\?=#\-@%\+_,:!]*)/gu;
export const getMatchHashtag = () => /(^|[^\p{L}])#([\p{L}\p{N}\p{M}]+)/gu;
export const getMatchLink = () => /https?:\/\/([a-zA-Z0-9\.\-]+\.[a-zA-Z]+)([\p{L}\p{N}\p{M}&\.-\/\?=#\-@%\+_,:!]*)/gu;
export const getMatchEmoji = () => /:([a-zA-Z0-9_-]+):/gi;
export const getMatchCashu = () => /cashuA[A-z0-9]+/g;