diff --git a/util/builtin_operators.go b/util/builtin_operators.go index 37d9cb5bf..4d25fd5fd 100644 --- a/util/builtin_operators.go +++ b/util/builtin_operators.go @@ -332,11 +332,7 @@ func KeyMatch5Func(args ...interface{}) (interface{}, error) { // RegexMatch determines whether key1 matches the pattern of key2 in regular expression. func RegexMatch(key1 string, key2 string) bool { - res, err := regexp.MatchString(key2, key1) - if err != nil { - panic(err) - } - return res + return mustCompileOrGet(key2).MatchString(key1) } // RegexMatchFunc is the wrapper for RegexMatch.