Regexp matching for templated links