From d3e294e1ce8dc7ae930958d02fbce9c3b10b19c0 Mon Sep 17 00:00:00 2001 From: Dirk Heilig Date: Thu, 19 Oct 2017 14:58:11 +0200 Subject: [PATCH] add regexReplace template function --- jiracli/templates.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jiracli/templates.go b/jiracli/templates.go index 1b64af8f..02e52c23 100644 --- a/jiracli/templates.go +++ b/jiracli/templates.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "reflect" "strconv" "strings" @@ -131,6 +132,10 @@ func TemplateProcessor() *template.Template { "color": func(color string) string { return ansi.ColorCode(color) }, + "regReplace": func(search string, replace string, content string) string { + re := regexp.MustCompile(search) + return re.ReplaceAllString(content, replace) + }, "split": func(sep string, content string) []string { return strings.Split(content, sep) },