Skip to content

Commit

Permalink
Unicode support for urIValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbiat committed Apr 4, 2021
1 parent fef0ee8 commit 249a4dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('/^(?<scheme>[a-z][a-z0-9+.-]+):(?<authority>\/\/(?<user>[^@]+@)?(?<host>[a-z0-9.\-_~]+)(?<port>:\d+)?)?(?<path>(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+(?:\/(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])*)*|(?:\/(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+)*)?(?<query>\?(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?(?<fragment>\#(?:[a-z0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?$/i', $this->htmlToRFC3986($string)) === 1) {
if (preg_match('/^(?<scheme>[a-z][a-z0-9+.-]+):(?<authority>\/\/(?<user>[^@]+@)?(?<host>[\p{L}0-9.\-_~]+)(?<port>:\d+)?)?(?<path>(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+(?:\/(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])*)*|(?:\/(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@])+)*)?(?<query>\?(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?(?<fragment>\#(?:[\p{L}0-9-._~]|%[a-f0-9]|[!$&\'()*+,;=:@]|[\/?])+)?$/iu', $this->htmlToRFC3986($string)) === 1) {
return true;
} else {
return false;
Expand Down

0 comments on commit 249a4dc

Please sign in to comment.