Matches the name against a regular expression.