Files
boris/node_modules/applesauce-content/dist/helpers/regexp.js
Gigi 5d53a827e0 feat: initialize markr nostr bookmark client
- Add project structure with TypeScript, React, and Vite
- Implement nostr authentication using browser extension (NIP-07)
- Add NIP-51 compliant bookmark fetching and display
- Create minimal UI with login and bookmark components
- Integrate applesauce-core and applesauce-react libraries
- Add responsive styling with dark/light mode support
- Include comprehensive README with setup instructions

This is a minimal MVP for a nostr bookmark client that allows users to
view their bookmarks according to NIP-51 specification.
2025-10-02 07:17:07 +02:00

49 lines
1.6 KiB
JavaScript

export const Expressions = {
get url() {
return /(?:https?|wss?|ircs?|s?ftp):\/\/([a-zA-Z0-9\.\-]+\.[a-zA-Z]+(?::\d+)?)([\/\?#][\p{L}\p{N}\p{M}&\.-\/\?=#\-@%\+_,:!~*]*)?/gu;
},
get link() {
return /https?:\/\/([a-zA-Z0-9\.\-]+\.[a-zA-Z]+(?::\d+)?)([\/\?#][\p{L}\p{N}\p{M}&\.-\/\?=#\-@%\+_,:!~*]*)?/gu;
},
get cashu() {
return /(?:cashu:\/{0,2})?(cashu(?:A|B)[A-Za-z0-9_-]{100,}={0,3})/gi;
},
get nostrLink() {
return /(?:nostr:)?((npub|note|nprofile|nevent|naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58,})/gi;
},
get emoji() {
return /:([a-zA-Z0-9_-]+):/gi;
},
get hashtag() {
// NOTE: cant use \b here because it uses \w which only matches latin letters
return /(?<=^|[^\p{L}#\/])#([\p{L}\p{N}\p{M}]+)(?=\p{Z}|$|\s)/gu;
},
get lightning() {
return /(?:lightning:)?(LNBC[A-Za-z0-9]+)/gim;
},
};
/** A list of Regular Expressions that match tokens surrounded by whitespace to avoid matching in URLs */
export const Tokens = {
get url() {
return Expressions.url;
},
get link() {
return Expressions.link;
},
get cashu() {
return new RegExp(`(?<=^|\\s)${Expressions.cashu.source}`, "gi");
},
get nostrLink() {
return new RegExp(`(?<=^|\\s)${Expressions.nostrLink.source}`, "gi");
},
get emoji() {
return Expressions.emoji;
},
get hashtag() {
return Expressions.hashtag;
},
get lightning() {
return new RegExp(`(?<=^|\\s)${Expressions.lightning.source}`, "gim");
},
};