I am using the following regex to match a URL:
$search = \"/([\\S]+\\.(MUSEUM|TRAVEL|AERO|ARPA|ASIA|COOP|INFO|NAME|BIZ|CAT|COM|INT|JOBS|NET|ORG|PRO|TEL|AC|A
Try Regexy::Web::Url
r = Regexy::Web::Url.new # matches 'http://foo.com', 'www.foo.com' and 'foo.com'