diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 11cd0394..484ef65b 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -60,7 +60,7 @@ export const validator = { isValidUrl: (urlString: string) => { const urlPattern = new RegExp( "^(https?:\\/\\/)?" + // validate protocol - "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // validate domain name + "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|localhost|" + // validate domain name "((\\d{1,3}\\.){3}\\d{1,3}))" + // validate OR ip (v4) address "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // validate port and path "(\\?[;&a-z\\d%_.~+=-]*)?" + // validate query string