Using regex for template rendering