From 015fdcfadb56067bd34ad502930ed0d0998a1fd5 Mon Sep 17 00:00:00 2001 From: eoverly Date: Mon, 4 Nov 2024 23:04:28 -0500 Subject: [PATCH 1/3] allow domain names in urls not starting with www --- src/pages/txt-generator.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index 5cc617e..22e54fb 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -36,7 +36,7 @@ const removeIndex = (array, index) => [ ] const urlRegex = new RegExp( - /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/ + /(https?:\/\/(?:\.|(?!))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:\.|(?!))[a-zA-Z0-9]+\.[^\s]{2,}|\.[a-zA-Z0-9]+\.[^\s]{2,})/ ) const TxtGenerator = () => { @@ -94,7 +94,7 @@ const TxtGenerator = () => { message: "Not a valid point-of-contact email", } } - + if ( state.hospitals.some((hospital) => !!hospital.mrfUrl) && state.hospitals.some((hospital) => !hospital.mrfUrl.match(urlRegex)) From b5c236327cbaa7bcfd59ebc73f76bfaba5749ccb Mon Sep 17 00:00:00 2001 From: eoverly Date: Mon, 4 Nov 2024 23:26:27 -0500 Subject: [PATCH 2/3] run prettier --- src/pages/txt-generator.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index 22e54fb..efd5bf3 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -94,7 +94,7 @@ const TxtGenerator = () => { message: "Not a valid point-of-contact email", } } - + if ( state.hospitals.some((hospital) => !!hospital.mrfUrl) && state.hospitals.some((hospital) => !hospital.mrfUrl.match(urlRegex)) From 625e069eb475da5a61c1f1485416c8ecd8651398 Mon Sep 17 00:00:00 2001 From: eoverly Date: Thu, 14 Nov 2024 13:45:20 -0500 Subject: [PATCH 3/3] add must match and took out initial . --- src/pages/txt-generator.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index efd5bf3..072e34d 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -36,7 +36,7 @@ const removeIndex = (array, index) => [ ] const urlRegex = new RegExp( - /(https?:\/\/(?:\.|(?!))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:\.|(?!))[a-zA-Z0-9]+\.[^\s]{2,}|\.[a-zA-Z0-9]+\.[^\s]{2,})/ + /^(https?:\/\/(?:|(?!))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:\.|(?!))[a-zA-Z0-9]+\.[^\s]{2,}|\.[a-zA-Z0-9]+\.[^\s]{2,})$/ ) const TxtGenerator = () => {