Comrades, I write the link parser
"https://domain.ru:8080/folder/subfolder/../././?var1=val1&var2=val2" "https://http.google.com/folder/././?var1=val1&var2=val2", "ftp://mail.ru/?hello=world&url=https://http.google.com/folder//././?var1=val1&var2=val2", what needs to be fixed in the regular account so that the result would be correct if there is no any part of the link (if there is no protocol, then everything is OK so that the regulars would not climb into the parameters)
here is my regular season:
$_re = "~^ (?:(?<protocol>http|https|ftp):\\/\\/)? (?<domain_name> (?<domain_2_lvl>[a-z0-9\.]+) \. (?<zone>[az]{2,4}) :?(?<port>[0-9]{4})? )? |(?<raw_folder> ((?<=\/)([az.]+)(?=\/))) |(?<script>script.php)? |\? |(?<key>[a-z0-9?\/_]+)=(?<value>[a-z0-9?\/_]+)? ~ix" preg_match_all($_re, $__url, $matches);