Escape hostgroup names in the validation.

The component expects the hostgroup name to be escaped.

This change may be backwards-incompatible.  However, AFAIK, we are the
only users of this component.