Do not use regex anymore to replace template variables as '$' is a valid character in class name and it has a specific meaning in regex. Fixes #18