This is an perfect example on how not to do url validation. I tried it on http://hs.fi (Helsingin sanomat, Finnish news magazine) but the site says it is an invalid URL.
$ curl --head 'http://hs.fi/
HTTP/1.1 301 Object Moved
Location: http://www.hs.fi/