This seems like a very round-about way to achieve such validation.  Is there an established "this is a valid hostname" regex that we can use?