match spec string to template string