Skip to content

Commit 4898742

Browse files
authored
Fix http://localhost:3000/ url validation case (#388)
* Fix http://localhost:3000/ url validation case * adjust min regex occurrences
1 parent 79164e9 commit 4898742

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const validator = {
6060
isValidUrl: (urlString: string) => {
6161
const urlPattern = new RegExp(
6262
"^(https?:\\/\\/)?" + // validate protocol
63-
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // validate domain name
63+
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|localhost|" + // validate domain name
6464
"((\\d{1,3}\\.){3}\\d{1,3}))" + // validate OR ip (v4) address
6565
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // validate port and path
6666
"(\\?[;&a-z\\d%_.~+=-]*)?" + // validate query string

0 commit comments

Comments
 (0)