Check for valid hostname and allow groups in section names

Section / hostname regex like this was not allowed: [vm[0-9]+]
This patch will allow those hostnames to be matched.