func TemplateWithDelimiters(s string, values map[string]interface{}, opening, closing string) string {
	escapeDelimiter := func(delim string) string {
		result := templateRe.ReplaceAllString(delim, "\\$1")
		return templateRe2.ReplaceAllString(result, "\\$")
	}

	openingDelim := escapeDelimiter(opening)
	closingDelim := escapeDelimiter(closing)
	r := regexp.MustCompile(openingDelim + `(.+?)` + closingDelim)
	matches := r.FindAllStringSubmatch(s, -1)
	for _, submatches := range matches {
		match := submatches[0]
		key := submatches[1]
		//log.Printf("match %s key %s\n", match, key)
		if values[key] != nil {
			v := fmt.Sprintf("%v", values[key])
			s = strings.Replace(s, match, v, -1)
		}
	}

	return s
}
func TemplateWithDelimiters(s string, values map[string]interface{}, opening, closing string) string {
	escapeDelimiter := func(delim string) string {
		result := templateRe.ReplaceAllString(delim, "\\$1")
		return templateRe2.ReplaceAllString(result, "\\$")
	}

	openingDelim := escapeDelimiter(opening)
	closingDelim := escapeDelimiter(closing)
	r := regexp.MustCompile(openingDelim + `(.+?)` + closingDelim)
	matches := r.FindAllStringSubmatch(s, -1)
	for _, submatches := range matches {
		match := submatches[0]
		key := submatches[1]
		
		if values[key] != nil {
			v := fmt.Sprintf("%v", values[key])
			s = strings.Replace(s, match, v, -1)
		}
	}

	return s
}
func TemplateWithDelimiters ( s string , values map [ string ] interface { } , opening , closing string ) string { escapeDelimiter := func ( delim string ) string { result := templateRe . ReplaceAllString ( delim , " \\ " ) return templateRe2 . ReplaceAllString ( result , " \\ " ) } openingDelim := escapeDelimiter ( opening ) closingDelim := escapeDelimiter ( closing ) r := regexp . MustCompile ( openingDelim + `(.+?)` + closingDelim ) matches := r . FindAllStringSubmatch ( s , - 1 ) for _ , submatches := range matches { match := submatches [ 0 ] key := submatches [ 1 ] //log.Printf("match %s key %s\n", match, key) if values [ key ] != nil { v := fmt . Sprintf ( " " , values [ key ] ) s = strings . Replace ( s , match , v , - 1 ) } } return s }
// TemplateWithDelimiters is string template with user-defineable opening and closing delimiters.
TemplateWithDelimiters is string template with user - defineable opening and closing delimiters .