Escape special regex chars in template strings.

Fixes #229.