improved match-string template