Update template.rb

Ensure that the regex to replace paths, always matches from the front of the string.