How can I use the code bellow to check if the domain is a real match.
For that domain and url is going to return true, but is going to work for this url = http://www.text-apple.com/uk/
to, which is not a true match.
But it should be a match in this case url = http://itunes.apple.com"
, so i need to add something like if there is a .
before the domain name then is a match.
domain = "apple.com"
url = "http://www.apple.com/uk/"
def domain_is_URL?(url, domain)
d = Regexp.escape(domain)
URI.parse(url).host.match(d)
end
Thank you