diff --git a/src/extensions/Bolt11Extension.ts b/src/extensions/Bolt11Extension.ts index 47f3817..ae1d70d 100644 --- a/src/extensions/Bolt11Extension.ts +++ b/src/extensions/Bolt11Extension.ts @@ -5,7 +5,7 @@ import { decode } from 'light-bolt11-decoder' import type { MarkdownSerializerState } from 'prosemirror-markdown' import { createPasteRuleMatch } from '../helpers/utils' -const LNBC_REGEX = /(lnbc[0-9a-z]{10,})/g +const LNBC_REGEX = /(?:^|\s)(lnbc[0-9a-z]{10,})/g declare module '@tiptap/core' { interface Commands { diff --git a/src/extensions/NAddrExtension.ts b/src/extensions/NAddrExtension.ts index 9424014..5eacf02 100644 --- a/src/extensions/NAddrExtension.ts +++ b/src/extensions/NAddrExtension.ts @@ -5,7 +5,7 @@ import type { AddressPointer } from 'nostr-tools/nip19' import type { MarkdownSerializerState } from 'prosemirror-markdown' import { createPasteRuleMatch } from '../helpers/utils' -export const NADDR_REGEX = /(nostr:)?(naddr1[0-9a-z]+)/g +export const NADDR_REGEX = /(?:^|\s)(nostr:)?(naddr1[0-9a-z]+)/g export interface NAddrAttributes { naddr: string diff --git a/src/extensions/NEventExtension.ts b/src/extensions/NEventExtension.ts index a3df039..80150e6 100644 --- a/src/extensions/NEventExtension.ts +++ b/src/extensions/NEventExtension.ts @@ -5,9 +5,9 @@ import type { EventPointer } from 'nostr-tools/nip19' import type { MarkdownSerializerState } from 'prosemirror-markdown' import { createPasteRuleMatch } from '../helpers/utils' -export const NOTE_REGEX = /(nostr:)?(note1[0-9a-z]+)/g +export const NOTE_REGEX = /(?:^|\s)(nostr:)?(note1[0-9a-z]+)/g -export const NEVENT_REGEX = /(nostr:)?(nevent1[0-9a-z]+)/g +export const NEVENT_REGEX = /(?:^|\s)(nostr:)?(nevent1[0-9a-z]+)/g export interface NEventAttributes { nevent: string diff --git a/src/extensions/NProfileExtension.ts b/src/extensions/NProfileExtension.ts index 8923275..4278f02 100644 --- a/src/extensions/NProfileExtension.ts +++ b/src/extensions/NProfileExtension.ts @@ -5,9 +5,9 @@ import type { ProfilePointer } from 'nostr-tools/nip19' import type { MarkdownSerializerState } from 'prosemirror-markdown' import { createPasteRuleMatch } from '../helpers/utils' -export const NPUB_REGEX = /(nostr:)?(npub1[0-9a-z]+)/g +export const NPUB_REGEX = /(?:^|\s)(nostr:)?(npub1[0-9a-z]+)/g -export const NPROFILE_REGEX = /(nostr:)?(nprofile1[0-9a-z]+)/g +export const NPROFILE_REGEX = /(?:^|\s)(nostr:)?(nprofile1[0-9a-z]+)/g export type NProfileAttributes = { nprofile: string