From 7b2078ccff8cf7591ab715e89f660698ec12d49a Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 7 Oct 2024 21:03:46 +0530 Subject: [PATCH] [WEB-2605] fix: update URL regex pattern to allow complex links. --- web/helpers/string.helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/helpers/string.helper.ts b/web/helpers/string.helper.ts index 1182feeb0a7..e4b4dc6651e 100644 --- a/web/helpers/string.helper.ts +++ b/web/helpers/string.helper.ts @@ -270,7 +270,7 @@ export const isCommentEmpty = (comment: string | undefined): boolean => { export const checkURLValidity = (url: string): boolean => { if (!url) return false; // regex to match valid URLs (with or without http/https) - const urlPattern = /^(https?:\/\/)?([\da-z.-]+)\.([a-z]{2,6})(\/[\w.-]*)*\/?(\?[=&\w.-]*)?$/i; + const urlPattern = /^(https?:\/\/)?([\w.-]+\.[a-z]{2,6})(\/[\w\-.~:/?#[\]@!$&'()*+,;=%]*)?$/i; // test if the URL matches the pattern return urlPattern.test(url); };