Old thread but I think my amendments may be helpful to someone else landing here:
I didn't like to check only for a "www" as a hostname, nowadays we may encounter different hostnames... Thus I extended the Regex with:
"((?:http|https)://)?(?:[A-Za-z0-9]{1,25}\\.)?[\\w\\d\\-_]+\\.\\w{2,3}(\\.\\w{2})?(/(?<=/)(?:[\\w\\d\\-./_]+)?)?"