Defining regular expressions using templates/types