diff options
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/util_string.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/templates/util_string.go b/modules/templates/util_string.go index 18a0d5cacc..613940ccdc 100644 --- a/modules/templates/util_string.go +++ b/modules/templates/util_string.go @@ -4,6 +4,7 @@ package templates import ( + "regexp" "strings" "code.gitea.io/gitea/modules/base" @@ -25,6 +26,10 @@ func (su *StringUtils) Contains(s, substr string) bool { return strings.Contains(s, substr) } +func (su *StringUtils) ReplaceAllStringRegex(s, regex, new string) string { + return regexp.MustCompile(regex).ReplaceAllString(s, new) +} + func (su *StringUtils) Split(s, sep string) []string { return strings.Split(s, sep) } |