First we test for space characters. If any are found, return false. Then split the url into scheme and domain portions, or for protocol relative (//example.com) urls, just the domain. Use is_urlto validate the two portions of the url. If both are valid, or for protocol relative if domain is valid, return true, else false.