func RegexTest(_ context.Context, args ...core.Value) (core.Value, error) {
	err := core.ValidateArgs(args, 2, 3)
	if err != nil {
		return values.None, err
	}
	text := args[0].String()
	exp := args[1].String()
	if len(args) > 2 {
		if args[2] == values.True {
			exp = "(?i)" + exp
		}
	}
	reg, err := regexp.Compile(exp)
	if err != nil {
		return values.None, err
	}
	matches := reg.MatchString(text)
	return values.NewBoolean(matches), nil
}
RegexTest test wether the regexp has at least one match in the given text.
@param text (String) - The string to split.
@param regex (String) - A regular expression to use for splitting the text.
@param caseInsensitive (Boolean) - If set to true, the matching will be case-insensitive. The default is false.
@return (Boolean) - Returns true if the pattern is contained in text, and false otherwise.
package strings
import (
	"context"
	"regexp"
	"github.com/MontFerret/ferret/pkg/runtime/core"
	"github.com/MontFerret/ferret/pkg/runtime/values"
	"github.com/MontFerret/ferret/pkg/runtime/values/types"
)
func RegexMatch(_ context.Context, args ...core.Value) (core.Value, error) {
	err := core.ValidateArgs(args, 2, 3)
	if err != nil {
		return values.None, err
	}
	text := args[0].String()
	exp := args[1].String()
	if len(args) > 2 {
		if args[2] == values.True {
			exp = "(?i)" + exp
		}
	}
	reg, err := regexp.Compile(exp)
	if err != nil {
		return values.None, err
	}
	matches := reg.FindAllStringSubmatch(text, -1)
	res := values.NewArray(10)
	if len(matches) == 0 {
		return res, nil
	}
	for _, m := range matches[0] {
		res.Push(values.NewString(m))
	}
	return res, nil
}
func RegexSplit(_ context.Context, args ...core.Value) (core.Value, error) {
	err := core.ValidateArgs(args, 2, 4)
	if err != nil {
		return values.None, err
	}
	text := args[0].String()
	exp := args[1].String()
	limit := -1
	if len(args) > 2 {
		if args[2].Type() == types.Int {
			limit = int(args[2].(values.Int))
		}
	}
	reg, err := regexp.Compile(exp)
	if err != nil {
		return values.None, err
	}
	matches := reg.Split(text, limit)
	res := values.NewArray(10)
	if len(matches) == 0 {
		return res, nil
	}
	for _, m := range matches {
		res.Push(values.NewString(m))
	}
	return res, nil
}