From df3efdee59e87c15e17fab58a70965aff17c3c2b Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 6 Sep 2024 14:09:18 -0700 Subject: [PATCH] Fix link regex to not catch periods at the end of links --- packages/content/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/content/src/index.ts b/packages/content/src/index.ts index bab8127..affce2c 100644 --- a/packages/content/src/index.ts +++ b/packages/content/src/index.ts @@ -217,7 +217,7 @@ export const parseInvoice = (text: string, context: ParseContext): ParsedInvoice export const parseLink = (text: string, context: ParseContext): ParsedLink | void => { const prev = last(context.results) - const [link] = text.match(/^([a-z\+:]{2,30}:\/\/)?[^<>\(\)\s]+\.[a-z]{2,6}[^\s]*[^<>"'\.!?,:\s\)\(]*/gi) || [] + const [link] = text.match(/^([a-z\+:]{2,30}:\/\/)?[-\.~\w]+\.[\w]{2,6}([^\s]*[^<>"'\.!,:\s\)\(]+)?/gi) || [] // Skip url if it's just the end of a filepath or an ellipse if (!link || prev?.type === ParsedType.Text && prev.value.endsWith("/") || link.match(/\.\./)) {