Used urlparse instead of regex.