@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @var string |
20 | 20 | */ |
21 | - protected string $regx = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/'; |
|
21 | + protected string $regx='/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @inheritdoc |
@@ -15,19 +15,19 @@ |
||
15 | 15 | */ |
16 | 16 | class UriValidator implements ValidatorInterface |
17 | 17 | { |
18 | - protected string $regex = '/^(https?):\/\/'. // protocol |
|
19 | - '(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+'. // username |
|
20 | - '(:([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?'. // password |
|
21 | - '@)?(?#'. // auth requires @ |
|
22 | - ')((([a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*'. // domain segments AND |
|
23 | - '[a-z][a-z0-9-]*[a-z0-9]'. // top level domain OR |
|
18 | + protected string $regex='/^(https?):\/\/'.// protocol |
|
19 | + '(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+'.// username |
|
20 | + '(:([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?'.// password |
|
21 | + '@)?(?#'.// auth requires @ |
|
22 | + ')((([a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*'.// domain segments AND |
|
23 | + '[a-z][a-z0-9-]*[a-z0-9]'.// top level domain OR |
|
24 | 24 | '|((\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])\.){3}'. |
25 | - '(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])'. // IP address |
|
26 | - ')(:\d+)?'. // port |
|
27 | - ')(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*'. // path |
|
28 | - '(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)'. // query string |
|
29 | - '?)?)?'. // path and query string optional |
|
30 | - '(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?'. // fragment |
|
25 | + '(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])'.// IP address |
|
26 | + ')(:\d+)?'.// port |
|
27 | + ')(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*'.// path |
|
28 | + '(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)'.// query string |
|
29 | + '?)?)?'.// path and query string optional |
|
30 | + '(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?'.// fragment |
|
31 | 31 | '$/i'; |
32 | 32 | |
33 | 33 | public function isValid(mixed $toValidate): bool |