Skip to content

Commit cfcc2d3

Browse files
committed
feat: add Arabic regex to url validation util
1 parent b158399 commit cfcc2d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export function isValidUrl(string: string) {
22
// Regex Source: https://www.freecodecamp.org/news/check-if-a-javascript-string-is-a-url/
33
const urlPattern = new RegExp(
44
"^(https?:\\/\\/)" + // validate protocol
5-
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // validate domain name
5+
"((([a-z\u0600-\u065F\u066E-\u06D5\\d]([a-z\u0600-\u065F\u066E-\u06D5\\d-]*[a-z\u0600-\u065F\u066E-\u06D5\\d])*)\\.)+[a-z\u0600-\u065F\u066E-\u06D5]{2,}|" + // validate domain name
66
"((\\d{1,3}\\.){3}\\d{1,3}))" + // validate OR ip (v4) address
77
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // validate port and path
88
"(\\?[;&a-z\\d%_.~+=-]*)?" + // validate query string

0 commit comments

Comments
 (0)