Converted to RegEx parsing of hostname
Added test for valid hostname method