Updated regex for template name generation