From 249a4dced9cbe1e8abdc8d393446b6eb91aabcfa Mon Sep 17 00:00:00 2001 From: Simbiat Date: Sun, 4 Apr 2021 10:48:18 +0300 Subject: [PATCH] Unicode support for urIValidator --- src/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common.php b/src/Common.php index b3ba111..f84ad98 100644 --- a/src/Common.php +++ b/src/Common.php @@ -820,7 +820,7 @@ public function emailValidator(string $string): bool #Function to check if string is an URI as per RFC 3986 public function uriValidator(string $string): bool { - if (preg_match('/^(?[a-z][a-z0-9+.-]+):(?\/\/(?[^@]+@)?(?[a-z0-9.\-_~]+)(?:\d+)?)?(?(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+(?:\/(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])*)*|(?:\/(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+)*)?(?\?(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?(?\#(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?$/i', $this->htmlToRFC3986($string)) === 1) { + if (preg_match('/^(?[a-z][a-z0-9+.-]+):(?\/\/(?[^@]+@)?(?[\p{L}0-9.\-_~]+)(?:\d+)?)?(?(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+(?:\/(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])*)*|(?:\/(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+)*)?(?\?(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?(?\#(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?$/iu', $this->htmlToRFC3986($string)) === 1) { return true; } else { return false;