[WEB-2605] fix: update URL regex pattern to allow complex links. (#5767)
This commit is contained in:
parent
2b1da96c3f
commit
7495a7d0cb
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue