Allow greater control over template regex matching.

Fixes 38
Merge pull request #39 from muff1nman/regex-tweaks

Allow greater control over template regex matching.