https://www.site.ru/news/###/###/###/###/SAMASSILKA.html
href="([^"]+?)"
function doesMatchMyFormat(string $url) : bool {
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
return false;
}
$host = parse_url($url, PHP_URL_HOST);
if ($host !== "www.site.ru") {
return false;
}
$path = parse_url($url, PHP_URL_PATH);
$parts = explode("/", $path);
if ($parts[1] !== "news") {
return false;
}
if (count($parts) !== 7) {
return false;
}
return true;
}