I'm not sure I like the idea of parsing templates with regular expressions. There is a better way, as demonstrated in Robe Pike's video[1] detailing how the Go template language is implemented.
Edit: which isn't meant to detract from the fact that this is a great article.
Edit: which isn't meant to detract from the fact that this is a great article.
[1]http://www.youtube.com/watch?v=HxaD_trXwRE