Merge branch 'bolli95-master'

dev
Mzack9999 2020-10-16 22:26:42 +02:00
commit 556a0b23fe
1 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import (
"net/url"
"regexp"
"strings"
"github.com/Knetic/govaluate"
"github.com/spaolacci/murmur3"
)
@ -47,7 +47,11 @@ func HelperFunctions() (functions map[string]govaluate.ExpressionFunction) {
}
functions["replace"] = func(args ...interface{}) (interface{}, error) {
return strings.ReplaceAll(args[0].(string), args[1].(string), args[2].(string)), nil
compiled, err := regexp.Compile(args[1].(string))
if err != nil {
return nil, err
}
return compiled.ReplaceAllString(args[0].(string), args[2].(string)), nil
}
functions["trim"] = func(args ...interface{}) (interface{}, error) {