网址验证?

Does anyone know an up to date regular expression for validating URLs? I found a few on Google but they all allowed junk URL's i.e (www.google_com) when testing.

My regular expression knowledge is not so vast, so I would hate to put something together that would fail under pressure.

Thanks.

You can use the filter functions in PHP

$filtered = filter_var($url, FILTER_VALIDATE_URL);

http://uk3.php.net/manual/en/function.filter-var.php

Not every problem should be answered with a regex.

http://php.net/manual/en/function.parse-url.php