Use urlparse rather than regex