It doesn’t seem correct to me to apply the invalid_hostname_characters RE to the entire address: you’d want to apply it to the host part only. But since we don’t really know whether address is a valid URl yet, there’s no easy way to extract the host part. So I’m not sure this makes sense.
11 + if (invalid_ hostname_ characters. match(address) ){
12 + return false
13 + }
It doesn’t seem correct to me to apply the invalid_ hostname_ characters RE to the entire address: you’d want to apply it to the host part only. But since we don’t really know whether address is a valid URl yet, there’s no easy way to extract the host part. So I’m not sure this makes sense.