It might be worthwhile to extract a regular expression that only matches hostnames and use it here, and use that regex as part of the FQDN regex on line 264.