Skip to content

Commit

Permalink
fix hashtags and links with mark char
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Oct 19, 2023
1 parent 5d66750 commit 5ac4cfc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-gifts-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nostrudel": patch
---

Fix hashtags and links with mark characters in them
2 changes: 1 addition & 1 deletion src/components/open-graph-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);

Expand Down
5 changes: 2 additions & 3 deletions src/helpers/regexp.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit 5ac4cfc

Please sign in to comment.